Letter archive collage — Newsletter block

Free

newsletter-letter-archive-collage · for journal, landing, account pages

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

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-letter-archive-collage

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import NewsletterLetterArchiveCollage from '@/components/trame/blocks/newsletter/newsletter-letter-archive-collage.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"
}
],
collage: [
{
src: "https://images.unsplash.com/photo-1676125105332-608345abe20e?w=1600&q=80",
alt: "A potter’s wheel surrounded by tools"
},
{
src: "https://images.unsplash.com/photo-1790788369204-69ec9d2d53e7?w=1600&q=80",
alt: "Hands shaping a clay bowl"
}
],
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"
}
}
</script>

<template>
<NewsletterLetterArchiveCollage v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordswhat the page offers ("Get our letters")
leadstringWordsone or two sentences under the title
lists*List[]Datathe newsletters the merchant sends
posts*Post[]Datapast issues, newest first: the sample archive
collageCollage[]up to four of the merchant’s own pictures for the collage
form*Formthe sign-up form: where it posts and its words
openstringActionthe action that opens one past issue; the issue is its record
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
List lists[] · 8 props
PropTypeDescription
id*string | numberDatathe list’s id in the tool that answers it: what the form sends back for it
name*stringWordsthe newsletter’s name ("The workshop journal")
cadence*stringWordshow often it is sent, as the merchant commits to it ("Every first Monday"): no promise the merchant does not keep
description*stringWordswhat it holds, in a sentence or two
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordsthe picture’s description
sampleSamplea past issue of this list, to read
checkedbooleanticked at first: the merchant’s choice for a list it recommends, or the lists a subscriber already has
Sample lists[].sample · 2 props
PropTypeDescription
action*stringActionthe action that opens a past issue of this list
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
Post posts[] · 9 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
title*stringWordsthe article’s title
excerptstringWordsa sentence or two from the article
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the cover picture shows
sectionstringWordsthe section it belongs to, e.g. "Guides"
authorAuthorwho wrote it
datestringWordswhen it was published, as the site writes it
readingTimestringWordshow long it takes to read, e.g. "6 min"
Author posts[].author · 6 props
PropTypeDescription
idstring | numberDatathe record’s id in the tool that answers it
name*stringWordsthe person’s name
rolestringWordstheir role or job title
companystringWordswhere they work
avatarstringPicturea picture: a root-relative path (/media/…) or an absolute URL
urlstringDesigna page about them
Collage collage[] · 2 props
PropTypeDescription
src*stringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows, when the words do not say it
Form form · 3 props
PropTypeDescription
submit*stringActionthe page action that receives the address and the chosen lists
submitLabel*stringWordsthe button’s words ("Subscribe", "Update")
consent*stringWordsthe consent sentence under the form: required, shown always
Options options · 6 props
PropTypeDescription
eyebrowstringWordsa short label over the title
postsTitlestringWordsthe title over the past issues ("Latest issues")
subscriberstringWordsthe address of a subscriber who is changing their lists, as the app knows it
status'success' | 'error'the section’s status: success, error
statusTextstringWordsthe answer to the form, as the app gives it
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa 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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
asseta picture’s address as your app serves it
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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 articles from 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

  • 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 signup signed: a letter written by one person: their note and their face beside the form, for an editorial tone.
  • Pictured signup: editorial or lifestyle shops: a picture the full height of the block, the form on its other side.
  • Production signup stepped: a batch in the making: the form beside its stages, with the one in progress marked — the merchant’s own only.
  • Release signup split date: a single dated release: its date set large, what is in it, the form beside it — the merchant’s own only.

All 25 newsletter blocks