Skip to content

Newsletter

An email sign-up on its own: an inline band between sections or a small card for a sidebar or blog post. It checks the address, shows progress, then a confirmation in the same space.

On this page
Used for
  • Changelog by email
  • Release updates sign-up
  • Blog subscribe
  • Sidebar offer

Examples

Variant

Installation

npx knowns-ui@latest add newsletter
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

onSubscribe
(email) => Promise<void | string>
Gets the trimmed address. Return a string or throw an Error to show a message.
variant
"inline" | "centered" | "card"
Default"inline"
A band with the copy beside the form, a centred band, or a compact card.
title / text / meta
ReactNode
Heading, one line on what they'll get, and a small detail such as how often.
note
ReactNode | boolean
Defaulttrue
Small print under the field. true uses a default no-spam line.
submitLabel / placeholder
string
Default"Subscribe"
Button and field text.
successText
(email) => ReactNode
What to say once it worked.

Use CTA Section with an email field when the sign-up is the page's closing ask. Use Newsletter when the sign-up is a side offer, such as at the end of a post. The message line under the field is reserved, so errors do not push the page down.

What it handles

  1. 01Offers an email sign-up as an inline band with copy on the left and the form on the right, a centred band, or a compact card.
  2. 02Checks the address with newsletterError once the field has been touched, and focuses the input when a submit is blocked.
  3. 03Calls onSubscribe and treats a returned string or a thrown error as the failure message shown under the field.
  4. 04Swaps the form for a confirmation row that names the address, or your successText, in the same space.
  5. 05Replaces the button label with a spinner while loading and keeps the button width, so the form does not jump.
  6. 06Takes a title, text, meta line such as the reader count, and a note that you can replace or hide with note={false}.

States

First render
Nothing. The form paints with its note under the field
none
Invalid address
The field turns invalid and the message replaces the note
none, at once
Subscribing
The label hides and a spinner shows in its place
none
Success
The form becomes the confirmation row
none, at once
Reduced motion
The spinner stops spinning
0ms

Works with

When to use

When to use

  • A sign-up as a side offer: the end of a post, a blog sidebar, between sections.
  • A changelog or release-notes list, in the card variant beside the entries.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Newsletter to my app and wire it to my own data.
  • I need a sign-up as a side offer: the end of a post, a blog sidebar, between sections. Set that up with the Knowns UI Newsletter.
  • Which Newsletter props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "newsletter" }) and search_docs({ query: "newsletter" }).

Need help?

Stuck on Newsletter, or found something off? We read every message.