Issue feed — Newsletter block
Freenewsletter-issue-feed · for journal, landing, account pages
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
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-issue-feedUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import NewsletterIssueFeed from '@/components/trame/blocks/newsletter/newsletter-issue-feed.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"
}
}
}
],
posts: [
{
id: "n12",
title: "Why our bowls are always thrown on the same wheel",
excerpt: "A forty-year-old tool, three settings and a habit no one wanted to change.",
section: "The workshop journal",
date: "September 1",
readingTime: "6 min"
},
{
id: "n11",
title: "The greenhouse in October, or how to hold out until spring",
excerpt: "What comes inside, what stays out and what we still sow.",
section: "Greenhouse notebook",
date: "August 15",
readingTime: "7 min"
}
],
form: {
submit: "newsletter",
submitLabel: "Subscribe",
consent: "Your address is only used to send the newsletters you checked. Every email includes an unsubscribe link."
},
open: "issue",
options: {
eyebrow: "Newsletters",
postsTitle: "Latest issues",
pageSize: 3
}
}
</script>
<template>
<NewsletterIssueFeed 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 |
| posts* | Post[] | Datapast issues, newest first: the feed |
| form* | Form | the sign-up form: where it posts and its words |
| open | string | Actionthe action that opens one past issue; the issue is its record |
| 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 |
Post posts[] · 9 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| title* | string | Wordsthe article’s title |
| excerpt | string | Wordsa sentence or two from the article |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the cover picture shows |
| section | string | Wordsthe section it belongs to, e.g. "Guides" |
| author | Author | who wrote it |
| date | string | Wordswhen it was published, as the site writes it |
| readingTime | string | Wordshow long it takes to read, e.g. "6 min" |
Author posts[].author · 6 props
| Prop | Type | Description |
|---|---|---|
| id | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe person’s name |
| role | string | Wordstheir role or job title |
| company | string | Wordswhere they work |
| avatar | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| url | string | Designa page about them |
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 · 7 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa short label over the title |
| postsTitle | string | Wordsthe title over the past issues ("Latest issues") |
| subscriber | string | Wordsthe address of a subscriber who is changing their lists, as the app knows it |
| pageSize | number | how many past issues show before "see more" |
| 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 |
| Link | your router’s link component |
| 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,open - Reads
articlesfrom your app
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
- 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.
- Hub checkbox grid: a compact two-column checklist and one update button: preferences for someone who already subscribes.
- Hub picker cards: a card for each newsletter with its cadence, a tick box and a sample link, then one address field: several letters to choose from.
- 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.