The visitor writes their address on a card and posts it: push Send, or drag the card down into the slot. The flap swings, the card drops through, and the plate thanks them. Give it your own subscribe handler, or put it in a form.
npx shadcn@latest add https://clickworks.dev/r/mail-slot.jsonThe files land in components/clickworks/mail-slot/. No other packages are added.
"use client"
import { MailSlot } from "@/components/clickworks/mail-slot/react/MailSlot"
export function Newsletter() {
return (
<MailSlot
card={{ heading: "One short email a month." }}
onSubscribe={(email) => fetch("/api/subscribe", { method: "POST", body: JSON.stringify({ email }) }).then((r) => r.ok)}
/>
)
}Sends the address to your list. Return false or throw to show the failed state. Without it, a surrounding form submits, or a demo plays.
Words on the card.
The engraving on the slot and the small note under it.
What the plate says once it's sent.
Status lines for each state.
Auto follows the page (its background, data-theme or dark class), then the device.
Default "auto"
Colours for each theme. Every shade and shadow is mixed from them.
Drag to post, sound and phone vibration.
Default all on
The card went through.
Sending failed. The address stays on the card.
Colours come in through the light and dark props, so each theme gets its own palette. It fills its width and keeps its proportions.