Skip to content
Klarhimmel UI

Newsletter, choose topics

Newsletter, choose topics previewNewsletter, choose topics preview

Install

npx shadcn add @klarhimmel/newsletter-topics
DetailsAbout, 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

import Block from '@/components/klarhimmel/blocks/newsletter-topics';
Also called
  • 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.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import NewsletterTopics from '@/components/klarhimmel/blocks/newsletter-topics';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <NewsletterTopics props={{
          "eyebrow": "Name the section",
          "title": "Say what subscribers get by email",
          "description": "Say in one or two sentences how to pick topics and how to change the choice later.",
          "topicsLabel": "Topic list",
          "topics": [
            {
              "label": "Name a topic",
              "description": "Say what the topic brings"
            },
            {
              "label": "Name a topic",
              "description": "Say what the topic brings"
            },
            {
              "label": "Name a topic",
              "description": "Say what the topic brings"
            },
            {
              "label": "Name a topic",
              "description": "Say what the topic brings"
            }
          ],
          "emailLabel": "Email address",
          "placeholder": "Your email address",
          "submit": "Subscribe",
          "consent": "Say how the address is kept and how to leave"
        }} />
      </BlockSurface>
    </Theme>
  );
}

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.

PropTypeDefaultDescription
eyebrowstring'Name the section'Text, up to 60 characters.
titlestring'Say what subscribers get by email'Text, up to 100 characters.
descriptionstring'Say in one or two sentences how to …'Text, up to 240 characters.
topicsLabelstring'Topic list'Text, up to 60 characters.
topics{ label, description, checked }[]4 itemsList of 2 to 6. Each item: label, description, checked (optional).
emailLabelstring'Email address'Text, up to 40 characters.
placeholderstring'Your email address'Text, up to 60 characters.
submitstring'Subscribe'Text, up to 24 characters.
consentstring'Say how the address is kept and how…'Text, up to 160 characters.
actionstring-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.
captchaboolean-Optional; empty is not rendered.
captchaSitekeystring-Text, up to 100 characters. Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.