Hub checkbox grid — Newsletter block
Freenewsletter-hub-checkbox-grid · for journal, landing, account pages
Hub checkbox grid
A compact two-column checklist and one update button: preferences for someone who already subscribes
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/newsletter-hub-checkbox-gridUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import NewsletterHubCheckboxGrid from '@/components/trame/blocks/newsletter/newsletter-hub-checkbox-grid.vue'
const props = {
title: "Get our newsletters",
lead: "Four newsletters, each on its own schedule. Check the ones you like; you can change your mind at any time.",
lists: [
{
id: "atelier",
name: "The workshop journal",
cadence: "The first Monday of the month",
description: "One making-of story, one photo and what’s new in the shop, nothing else.",
image: "https://images.unsplash.com/photo-1676125105332-608345abe20e?w=1600&q=80",
alt: "A potter’s wheel surrounded by tools",
sample: {
action: "issue",
record: {
id: "atelier-12"
}
},
checked: true
},
{
id: "jardin",
name: "Greenhouse notebook",
cadence: "Twice a month",
description: "What we sow, what we bring in, and the seedlings available in the shop.",
image: "https://images.unsplash.com/photo-1508857650881-64475119d798?w=1600&q=80",
alt: "Inside a greenhouse, rows of young seedlings",
sample: {
action: "issue",
record: {
id: "jardin-8"
}
}
}
],
form: {
submit: "newsletter",
submitLabel: "Subscribe",
consent: "Your address is only used to send the newsletters you checked. Every email includes an unsubscribe link."
},
options: {
eyebrow: "Newsletters"
}
}
</script>
<template>
<NewsletterHubCheckboxGrid v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the page offers ("Get our letters") |
| lead | string | Wordsone or two sentences under the title |
| lists* | List[] | Datathe newsletters the merchant sends |
| form* | Form | the sign-up form: where it posts and its words |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
List lists[] · 8 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe list’s id in the tool that answers it: what the form sends back for it |
| name* | string | Wordsthe newsletter’s name ("The workshop journal") |
| cadence* | string | Wordshow often it is sent, as the merchant commits to it ("Every first Monday"): no promise the merchant does not keep |
| description* | string | Wordswhat it holds, in a sentence or two |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordsthe picture’s description |
| sample | Sample | a past issue of this list, to read |
| checked | boolean | ticked at first: the merchant’s choice for a list it recommends, or the lists a subscriber already has |
Sample lists[].sample · 2 props
| Prop | Type | Description |
|---|---|---|
| action* | string | Actionthe action that opens a past issue of this list |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
Form form · 3 props
| Prop | Type | Description |
|---|---|---|
| submit* | string | Actionthe page action that receives the address and the chosen lists |
| submitLabel* | string | Wordsthe button’s words ("Subscribe", "Update") |
| consent* | string | Wordsthe consent sentence under the form: required, shown always |
Options options · 5 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short label over the title |
| subscriber | string | Wordsthe address of a subscriber who is changing their lists, as the app knows it |
| status | 'success' | 'error' | the section’s status: success, error |
| statusText | string | Wordsthe answer to the form, as the app gives it |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
lists[].sample,form.submit
A newsletter section, for journal, landing, account pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
More newsletter blocks
- Email capture centered: the classic block of a home page: a title, one line of promise, one field.
- Facts: the merchant states real figures about the letter: its facts as tiles beside the form.
- Guide signup split form: one guide traded for an address: its cover and contents beside the field; the merchant’s own only.
- Issue feed: one signup row over the stack of past issues (and the lists in a second tab): a journal that wants its archive read.
- Issue preview split preview: the merchant has a real newsletter: the form beside a card showing what an issue looks like.
- Journal signup with issues: the journal has already gone out: the form beside its last issues, as proof of what arrives.
- Latest issue signup cover card: the latest issue shown as a cover card beside the form: one strong issue to sell the next ones.
- Letter archive collage: an intro with a collage of the merchant’s pictures and the form, a sample archive beside it: one letter with a real history.