Newsletter signup
An email signup framed by a stack of past issues; subscribing drops the next issue, addressed to you, onto the front.
npx shadcn@latest add @silicon-ui/newsletter-signupInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/newsletter-signupManually
Install the dependencies
npm install @radix-ui/react-switch lucide-react motionCopy these files into your project
- components/silicon-ui/blocks/newsletter-signup/newsletter-signup.tsx
- components/silicon-ui/blocks/newsletter-signup/newsletter-signup-data.ts
- components/silicon-ui/blocks/newsletter-signup/newsletter-signup.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/media.ts
- components/silicon-ui/switch/switch.tsx
- components/silicon-ui/switch/switch.module.css
- components/silicon-ui/segmented-control/segmented-control.tsx
- components/silicon-ui/segmented-control/segmented-control.module.css
- components/silicon-ui/animated-counter/animated-counter.tsx
- components/silicon-ui/animated-counter/animated-counter.module.css
- components/silicon-ui/lib/fluid-hover.tsx
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
NewsletterSignup
| Prop | Type | Default |
|---|---|---|
variant`inline` puts the copy and form beside the issue stack; `card` is a self-contained card with the stack in a tray on top. | NewsletterVariant
| "inline" |
title | string | — |
description | string | — |
placeholder | string | "you@company.com" |
buttonLabel | string | "Subscribe" |
privacyNoteShort line under the form about frequency and privacy. | ReactNode | newsletterCopy.privacy |
privacyLinkLink after the privacy note. Pass null to hide it. | { label: string; href: string } | null | newsletterCopy.privacyLink |
readersReader count and up to three faces. The count ticks up by one when someone subscribes. Pass null to hide it. | { count: number; faces: string[] } | null | newsletterReaders |
publicationThe issue stack. On success the upcoming issue, addressed to the new reader, lands on top. Pass null for a form without the stack. | NewsletterPublication | null | newsletterPublication |
onSubscribeCalled with a valid, trimmed email. Reject to show an error and keep the email; resolve to show the success state. | (email: string) => void | Promise<void> | — |
className | string | — |
Also accepts the props of HTMLAttributes.