Newsletter, choose topics


Install
npx shadcn add @klarhimmel/newsletter-topicsDetailsAbout, usage, props and more
A sign-up where readers tick the topics they want (two to six checkbox cards) before giving an email address. Fewer unsubscribes, better targeting.
Import
Import
- newsletter/topics
- Category
- An email sign-up, inline or as a card. New project? Set it up once: /get-started/installation.
Notes
When to use it
A sign-up where readers tick the topics they want before giving an address, which means fewer unsubscribes later. For a simple list with one stream, newsletter-card or newsletter-inline is enough.
Writing for it
- Topics need two to six entries, each with a label (40, required) and a description (100). The label is also the submitted value, so keep it stable once the backend relies on it. - Use topicsLabel (60) as the instruction above the boxes, for instance 'Pick what you want to hear about'. - Leave checked unset on every topic. The spec says a pre-ticked box is not consent, so only set it when the reader has already chosen.
Watch out for
The email label (40) is required and the whole email row, input and button included, disappears when it is empty outside the editor. The placeholder is only shown as a field of its own while editing.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Name the section' | Text, up to 60 characters. |
title | string | 'Say what subscribers get by email' | Text, up to 100 characters. |
description | string | 'Say in one or two sentences how to …' | Text, up to 240 characters. |
topicsLabel | string | 'Topic list' | Text, up to 60 characters. |
topics | { label, description, checked }[] | 4 items | List of 2 to 6. Each item: label, description, checked (optional). |
emailLabel | string | 'Email address' | Text, up to 40 characters. |
placeholder | string | 'Your email address' | Text, up to 60 characters. |
submit | string | 'Subscribe' | Text, up to 24 characters. |
consent | string | 'Say how the address is kept and how…' | Text, up to 160 characters. |
action | string | - | Text, up to 300 characters. Optional; empty is not rendered. |
method | 'post' | 'get' | - | One of 'post', 'get'. Optional; empty is not rendered. |
hidden | { } | - | Optional; empty is not rendered. |
captcha | boolean | - | Optional; empty is not rendered. |
captchaSitekey | string | - | Text, up to 100 characters. Optional; empty is not rendered. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |