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.
- Changelog by email
- Release updates sign-up
- Blog subscribe
- Sidebar offer
Examples
Installation
npx knowns-ui@latest add newsletterPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Newsletter from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/newsletter
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add newsletter
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/blocks/marketing/marketing-2b-utils.ts
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/marquee/marquee.tsx
- components/ui/knowns/marquee/marquee-utils.ts
- components/ui/knowns/blocks/marketing/section-heading.tsx
- components/ui/knowns/blocks/marketing/marketing-utils.ts
- components/ui/knowns/blocks/marketing/newsletter.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/newsletter, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "newsletter" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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- Default
true - 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.
| Prop | Type | Default | Description |
|---|---|---|---|
| onSubscribe | (email) => Promise<void | string> | - | Gets the trimmed address. Return a string or throw an Error to show a message. |
| variant | "inline" | "centered" | "card" | "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 | true | Small print under the field. true uses a default no-spam line. |
| submitLabel / placeholder | string | "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
- 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.
- 02Checks the address with newsletterError once the field has been touched, and focuses the input when a submit is blocked.
- 03Calls onSubscribe and treats a returned string or a thrown error as the failure message shown under the field.
- 04Swaps the form for a confirmation row that names the address, or your successText, in the same space.
- 05Replaces the button label with a spinner while loading and keeps the button width, so the form does not jump.
- 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
| State | What moves | Timing |
|---|---|---|
| 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
- The closing ask of a landing page: use CTA Section.
- Collecting more than an email: use a full form: use Contact Section.
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" }).