A modal window for one step that needs an answer
Press Invite; Esc or Cancel folds it back and focus returns
pnpm dlx shadcn@latest add https://notchset.dev/r/dialog.jsonOne focused step that needs an answer before you go on.
Every shadcn style · one file
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { Button, ButtonPlane } from "@/components/ui/notchset/button";
import { Dialog } from "@/components/ui/notchset/dialog";
import { TextField } from "@/components/ui/notchset/text-field";
import { Select } from "@/components/ui/notchset/select";
import { AvatarStack } from "@/components/ui/notchset/avatar-stack";
import { ButtonRoll, ButtonTick, play } from "@/lib/notchset/button-look";
import { UserPlus } from "@/lib/notchset/icons";
import type { FeedbackProps } from "@/lib/notchset/feedback";
/*
* The button that asks, at rest on the plain ground: pressed, the dialog grows out of it (nothing dimmed in a preview)
* and folds back into it on Cancel, Esc or the verb. The knobs pick what it is for (a new
* record with a required name, a delete with its danger verb, an invite), a verb that runs for a moment
* (busy, then it closes) and a long body that scrolls between the title and the verbs. Create with the name empty is
* refused: focus goes to the name. Used in: a new project, a
* delete and an invite. On its item page only the invite shows, closed at rest: a modal never opens itself on view.
*/
type Use = "create" | "delete" | "invite";
const COPY: Record<Use, { title: string; description: string }> = {
create: { title: "New project", description: "It starts empty and shows on Home for everyone in Design." },
delete: { title: "Delete Roadmap?", description: "Its 24 tasks and 3 files go with it. This can't be undone." },
invite: { title: "Invite people", description: "They join as members and get an email with a link." },
};
const VERB: Record<Use, { label: string; busyLabel: string; intent?: "danger" }> = {
create: { label: "Create project", busyLabel: "Creating…" },
delete: { label: "Delete project", busyLabel: "Deleting…", intent: "danger" },
invite: { label: "Send invites", busyLabel: "Sending…" },
};
const LONG = [
"Everyone in the workspace can see it, and anyone with a link can open it. Its owner can change that later.",
"Its files stay in Google Drive and Dropbox, where they were made; only the links move with it.",
"Its activity is kept for 90 days, then only the summary stays. An export keeps all of it.",
"Members get one email now and a digest each Monday; each can turn either off in their settings.",
];
/* The invite, the page's scene: a face and "Invite" at rest. Pressed, the dialog grows out of the button; the email
starts empty. Send invite: refused while the address is not one (focus goes to it), else busy, then "Invited" with
the ring, and the dialog folds back into the button; only then does the button roll to "Invited · 2" and the new face
hop into the stack. */
const TEAM = [{ name: "Ana Ruiz", role: "Account executive", src: "https://notchset.dev/media/people/person-07.webp" }];
const INVITE = { title: "Invite to the sales team", line: "They get a link to join, good for 7 days.", email: "Email", emailHint: "One address; they join as the role below", placeholder: "name@company.com", bad: "Type one email address, like ines@notchset.com", role: "Role", member: "Member", admin: "Admin", memberHint: "Works on every deal and task", adminHint: "Also manages the team and billing", invite: "Invite", invited: "Invited · {n}", send: "Send invite", sending: "Sending…", sent: "Invited" };
const nameOf = (email: string) => {
const n = email.split("@")[0] ?? "";
return n.charAt(0).toUpperCase() + n.slice(1);
};
function InviteScene({ onFeedback: sound }: FeedbackProps) {
const L = INVITE;
const trigger = React.useRef<HTMLButtonElement>(null);
const stack = React.useRef<HTMLDivElement>(null);
const [open, setOpen] = React.useState(false);
const [email, setEmail] = React.useState("");
const [bad, setBad] = React.useState(false);
const [role, setRole] = React.useState<"member" | "admin">("member");
const [step, setStep] = React.useState<"rest" | "busy" | "done">("rest");
const [doneAt, setDoneAt] = React.useState<number>();
const [team, setTeam] = React.useState(TEAM);
const timers = React.useRef<ReturnType<typeof setTimeout>[]>([]);
const later = (f: () => void, ms: number) => void timers.current.push(setTimeout(f, ms));
React.useEffect(() => () => timers.current.forEach(clearTimeout), []);
const show = (o: boolean) => {
if (o) {
setEmail("");
setBad(false);
setStep("rest");
}
setOpen(o);
};
const run = () => {
if (step !== "rest") return;
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email.trim())) {
setBad(true);
return;
}
setStep("busy");
later(() => (setStep("done"), setDoneAt(Date.now())), 900);
/* the ring shows, then it folds back (820ms after the success) */
later(() => setOpen(false), 900 + 820);
};
const landed = () => {
setTeam((t) => [...t, { name: nameOf(email.trim()) || "Ines", role: L.member, src: "https://notchset.dev/media/people/person-03.webp" }]);
requestAnimationFrame(() => play(stack.current?.querySelector("[data-slot=avatar]:last-of-type"), "hop"));
};
const n = team.length;
return (
<div className="flex min-h-[460px] w-[340px] max-w-full items-center justify-center gap-2">
<div ref={stack} className="[transition:width_260ms_var(--ns-ease-move)]">
<AvatarStack people={team} size="sm" />
</div>
<Button ref={trigger} aria-expanded={open} onClick={() => show(true)}>
{n > 1 ? <ButtonTick /> : <UserPlus aria-hidden />}
<ButtonRoll k={String(n)}>{n > 1 ? L.invited.replace("{n}", String(n)) : L.invite}</ButtonRoll>
</Button>
<Dialog
open={open}
onOpenChange={(o) => step === "rest" || !o ? show(o) : undefined}
origin={trigger}
onDone={landed}
onFeedback={sound}
size="sm"
title={L.title}
description={L.line}
verb={{ label: L.send, icon: <ButtonPlane />, busy: step === "busy", busyLabel: L.sending, doneLabel: L.sent, doneAt: step === "done" ? doneAt : undefined, onClick: run }}
>
<div className="flex flex-col gap-4">
<TextField
label={L.email}
type="email"
inputMode="email"
autoComplete="off"
placeholder={L.placeholder}
value={email}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => (setEmail(e.target.value), setBad(false))}
hint={L.emailHint}
error={bad ? L.bad : undefined}
required
/>
<Select
label={L.role}
value={role}
onValueChange={(v) => setRole(v)}
options={[{ value: "member", label: L.member }, { value: "admin", label: L.admin }]}
hint={role === "member" ? L.memberHint : L.adminHint}
/>
</div>
</Dialog>
</div>
);
}
export default function DialogDemo() {
return <InviteScene />;
}
/** The same dialog for a new record or a delete: its trigger at rest, the dialog grown out of it. */
export function DialogFor({ use, onFeedback: sound }: { use: Use } & FeedbackProps) {
if (use === "invite") return <InviteScene onFeedback={sound} />;
return <OtherDialog use={use} onFeedback={sound} />;
}
function OtherDialog({ use, onFeedback: sound }: { use: Use } & FeedbackProps) {
const busy = false;
const long = false;
const copy = COPY[use];
const verb = VERB[use];
const [open, setOpen] = React.useState(false);
const trigger = React.useRef<HTMLButtonElement>(null);
const [running, setRunning] = React.useState(false);
const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);
const show = (o: boolean) => {
clearTimeout(timer.current);
setRunning(false);
setOpen(o);
};
React.useEffect(() => () => clearTimeout(timer.current), []);
const run = () => {
if (!busy) return show(false);
setRunning(true);
timer.current = setTimeout(() => show(false), 1200);
};
return (
/* room for the dialog it opens: the stage is its page, so the dialog shows whole, centred in it */
<div className="flex min-h-[460px] w-[340px] max-w-full items-center justify-center">
<Button ref={trigger} intent={verb.intent ?? "primary"} aria-expanded={open} onClick={() => show(true)}>
{use === "delete" ? "Delete project" : copy.title}
</Button>
<Dialog
open={open}
onOpenChange={show}
origin={trigger}
onFeedback={sound}
title={copy.title}
description={copy.description}
verb={{ label: verb.label, intent: verb.intent, busy: running, busyLabel: verb.busyLabel, onClick: run }}
>
{use === "create" && <TextField label="Name" defaultValue="Website relaunch" required />}
{use === "invite" && <TextField label="Emails" placeholder="ana@stripe.com, lee@linear.app" inputMode="email" />}
{long && (
<div className="flex flex-col gap-3 text-[var(--ns-ink-2)]">
{[...LONG, ...LONG].map((p, i) => (
<p key={i} className="m-0">
{p}
</p>
))}
</div>
)}
</Dialog>
</div>
);
}"use client";
import * as React from "react";
import { Button, ButtonPlane } from "@/components/ui/notchset/button";
import { Dialog } from "@/components/ui/notchset/dialog";
import { TextField } from "@/components/ui/notchset/text-field";
import { Select } from "@/components/ui/notchset/select";
import { AvatarStack } from "@/components/ui/notchset/avatar-stack";
import { ButtonRoll, ButtonTick, play } from "@/lib/notchset/button-look";
import { UserPlus } from "@/lib/notchset/icons";
import type { FeedbackProps } from "@/lib/notchset/feedback";
/*
* The button that asks, at rest on the plain ground: pressed, the dialog grows out of it (nothing dimmed in a preview)
* and folds back into it on Cancel, Esc or the verb. The knobs pick what it is for (a new
* record with a required name, a delete with its danger verb, an invite), a verb that runs for a moment
* (busy, then it closes) and a long body that scrolls between the title and the verbs. Create with the name empty is
* refused: focus goes to the name. Used in: a new project, a
* delete and an invite. On its item page only the invite shows, closed at rest: a modal never opens itself on view.
*/
type Use = "create" | "delete" | "invite";
const COPY: Record<Use, { title: string; description: string }> = {
create: { title: "New project", description: "It starts empty and shows on Home for everyone in Design." },
delete: { title: "Delete Roadmap?", description: "Its 24 tasks and 3 files go with it. This can't be undone." },
invite: { title: "Invite people", description: "They join as members and get an email with a link." },
};
const VERB: Record<Use, { label: string; busyLabel: string; intent?: "danger" }> = {
create: { label: "Create project", busyLabel: "Creating…" },
delete: { label: "Delete project", busyLabel: "Deleting…", intent: "danger" },
invite: { label: "Send invites", busyLabel: "Sending…" },
};
const LONG = [
"Everyone in the workspace can see it, and anyone with a link can open it. Its owner can change that later.",
"Its files stay in Google Drive and Dropbox, where they were made; only the links move with it.",
"Its activity is kept for 90 days, then only the summary stays. An export keeps all of it.",
"Members get one email now and a digest each Monday; each can turn either off in their settings.",
];
/* The invite, the page's scene: a face and "Invite" at rest. Pressed, the dialog grows out of the button; the email
starts empty. Send invite: refused while the address is not one (focus goes to it), else busy, then "Invited" with
the ring, and the dialog folds back into the button; only then does the button roll to "Invited · 2" and the new face
hop into the stack. */
const TEAM = [{ name: "Ana Ruiz", role: "Account executive", src: "https://notchset.dev/media/people/person-07.webp" }];
const INVITE = { title: "Invite to the sales team", line: "They get a link to join, good for 7 days.", email: "Email", emailHint: "One address; they join as the role below", placeholder: "name@company.com", bad: "Type one email address, like ines@notchset.com", role: "Role", member: "Member", admin: "Admin", memberHint: "Works on every deal and task", adminHint: "Also manages the team and billing", invite: "Invite", invited: "Invited · {n}", send: "Send invite", sending: "Sending…", sent: "Invited" };
const nameOf = (email: string) => {
const n = email.split("@")[0] ?? "";
return n.charAt(0).toUpperCase() + n.slice(1);
};
function InviteScene({ onFeedback: sound }: FeedbackProps) {
const L = INVITE;
const trigger = React.useRef<HTMLButtonElement>(null);
const stack = React.useRef<HTMLDivElement>(null);
const [open, setOpen] = React.useState(false);
const [email, setEmail] = React.useState("");
const [bad, setBad] = React.useState(false);
const [role, setRole] = React.useState<"member" | "admin">("member");
const [step, setStep] = React.useState<"rest" | "busy" | "done">("rest");
const [doneAt, setDoneAt] = React.useState<number>();
const [team, setTeam] = React.useState(TEAM);
const timers = React.useRef<ReturnType<typeof setTimeout>[]>([]);
const later = (f: () => void, ms: number) => void timers.current.push(setTimeout(f, ms));
React.useEffect(() => () => timers.current.forEach(clearTimeout), []);
const show = (o: boolean) => {
if (o) {
setEmail("");
setBad(false);
setStep("rest");
}
setOpen(o);
};
const run = () => {
if (step !== "rest") return;
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email.trim())) {
setBad(true);
return;
}
setStep("busy");
later(() => (setStep("done"), setDoneAt(Date.now())), 900);
/* the ring shows, then it folds back (820ms after the success) */
later(() => setOpen(false), 900 + 820);
};
const landed = () => {
setTeam((t) => [...t, { name: nameOf(email.trim()) || "Ines", role: L.member, src: "https://notchset.dev/media/people/person-03.webp" }]);
requestAnimationFrame(() => play(stack.current?.querySelector("[data-slot=avatar]:last-of-type"), "hop"));
};
const n = team.length;
return (
<div className="flex min-h-[460px] w-[340px] max-w-full items-center justify-center gap-2">
<div ref={stack} className="[transition:width_260ms_var(--ns-ease-move)]">
<AvatarStack people={team} size="sm" />
</div>
<Button ref={trigger} aria-expanded={open} onClick={() => show(true)}>
{n > 1 ? <ButtonTick /> : <UserPlus aria-hidden />}
<ButtonRoll k={String(n)}>{n > 1 ? L.invited.replace("{n}", String(n)) : L.invite}</ButtonRoll>
</Button>
<Dialog
open={open}
onOpenChange={(o) => step === "rest" || !o ? show(o) : undefined}
origin={trigger}
onDone={landed}
onFeedback={sound}
size="sm"
title={L.title}
description={L.line}
verb={{ label: L.send, icon: <ButtonPlane />, busy: step === "busy", busyLabel: L.sending, doneLabel: L.sent, doneAt: step === "done" ? doneAt : undefined, onClick: run }}
>
<div className="flex flex-col gap-4">
<TextField
label={L.email}
type="email"
inputMode="email"
autoComplete="off"
placeholder={L.placeholder}
value={email}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => (setEmail(e.target.value), setBad(false))}
hint={L.emailHint}
error={bad ? L.bad : undefined}
required
/>
<Select
label={L.role}
value={role}
onValueChange={(v) => setRole(v)}
options={[{ value: "member", label: L.member }, { value: "admin", label: L.admin }]}
hint={role === "member" ? L.memberHint : L.adminHint}
/>
</div>
</Dialog>
</div>
);
}
export default function DialogDemo() {
return <InviteScene />;
}
/** The same dialog for a new record or a delete: its trigger at rest, the dialog grown out of it. */
export function DialogFor({ use, onFeedback: sound }: { use: Use } & FeedbackProps) {
if (use === "invite") return <InviteScene onFeedback={sound} />;
return <OtherDialog use={use} onFeedback={sound} />;
}
function OtherDialog({ use, onFeedback: sound }: { use: Use } & FeedbackProps) {
const busy = false;
const long = false;
const copy = COPY[use];
const verb = VERB[use];
const [open, setOpen] = React.useState(false);
const trigger = React.useRef<HTMLButtonElement>(null);
const [running, setRunning] = React.useState(false);
const timer = React.useRef<ReturnType<typeof setTimeout>>(undefined);
const show = (o: boolean) => {
clearTimeout(timer.current);
setRunning(false);
setOpen(o);
};
React.useEffect(() => () => clearTimeout(timer.current), []);
const run = () => {
if (!busy) return show(false);
setRunning(true);
timer.current = setTimeout(() => show(false), 1200);
};
return (
/* room for the dialog it opens: the stage is its page, so the dialog shows whole, centred in it */
<div className="flex min-h-[460px] w-[340px] max-w-full items-center justify-center">
<Button ref={trigger} intent={verb.intent ?? "primary"} aria-expanded={open} onClick={() => show(true)}>
{use === "delete" ? "Delete project" : copy.title}
</Button>
<Dialog
open={open}
onOpenChange={show}
origin={trigger}
onFeedback={sound}
title={copy.title}
description={copy.description}
verb={{ label: verb.label, intent: verb.intent, busy: running, busyLabel: verb.busyLabel, onClick: run }}
>
{use === "create" && <TextField label="Name" defaultValue="Website relaunch" required />}
{use === "invite" && <TextField label="Emails" placeholder="ana@stripe.com, lee@linear.app" inputMode="email" />}
{long && (
<div className="flex flex-col gap-3 text-[var(--ns-ink-2)]">
{[...LONG, ...LONG].map((p, i) => (
<p key={i} className="m-0">
{p}
</p>
))}
</div>
)}
</Dialog>
</div>
);
}This example also uses Avatar stack, Select, Text field. This command installs them with it, so the example pastes as it is:
pnpm dlx shadcn@latest add https://notchset.dev/r/dialog.json https://notchset.dev/r/avatar-stack.json https://notchset.dev/r/select.json https://notchset.dev/r/text-field.jsoncomponents/ui/notchset/dialog.tsx
LevelMolecule: made of atoms only.
Made ofButton
Free, no account or key. One command for every shadcn style. With the @notchset registry added, @notchset/<name> works too.
Works with React 18.3 or 19 on Tailwind CSS v4, in any shadcn project. What's tested
pnpm add @base-ui/react@^1 lucide-react@^1The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
The sound you hear is this page's: the piece you install plays none, and calls onFeedback on each move so you can add your own.
open–
booleanopen (controlled, with onOpenChange); else defaultOpen, and it keeps its own state
defaultOpen–
booleanopened on arrival when uncontrolled
onOpenChange–
(open: boolean) => voidcalled with the next open state: Cancel, Escape, the close button or the verb's run
title–
React.ReactNodewhat the dialog is for, as its heading and accessible name
description–
React.ReactNodeone line under the title saying what will happen
verb–
Verbthe one action that completes it (label, run, "danger" for a destructive step); without it the dialog only closes
noCancel–
booleanHide Cancel when the step has its own way back (a two-step flow).
footNote–
React.ReactNodeWords or a link at the footer's left ("Sent from ana@northwind.com"); not on a phone, where the verbs take the width.
back–
{ label: string; onClick: () => void }A way back a step, at the footer's start; on a phone it takes Cancel's place (× and a swipe still close).
size"md"
"sm" | "md" | "lg"its width: sm for a confirm, md (the default) for a short form, lg for a wide form
labels–
Partial<DialogLabels>its built-in words (DIALOG_LABELS)
origin–
React.RefObject<HTMLElement | null> | HTMLElement | nullThe control it grows out of and folds back into; else the control last pressed or focused outside a layer.
onDone–
() => voidCalled once the dialog has folded back after its verb finished (doneAt set when it closed), so the page changes after the dialog is gone; Cancel, Esc and × never call it.
onFeedback–
(e: FeedbackEvent) => voidcalled once per move, for your sound or haptics
Three usesa new record with a required name · confirming a delete · inviting people by email
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)v2.0.0 · 2026-11-17breaking
No longer ships button-look.ts (ButtonBin, ButtonBusy, ButtonPlane, ButtonPuff, ButtonRoll, ButtonSparks, ButtonTick, EdgeBurst, QUIET_PILL, buttonBase, buttonIntents, buttonResults, buttonRollLayer, buttonSizes, buttonSquare, play, ButtonRollState, useButtonRoll), which it stopped using; a copy that imported them through this item imports them from button-class.ts and button-move.ts.ts. Ships button-move.ts (ButtonRoll, buttonRollLayer, play, ButtonRollState, useButtonRoll), which it now uses. Ships scrim.ts (scrim), which it now uses. Internal files split; installs smaller; no change to the piece's own API. Renamed: . recheck: copies that import button-look.ts through dialog
v1.1.0 · 2026-11-17
New props: onDone, onFeedback, origin. Ships button-look.ts (ButtonBin, ButtonBusy, ButtonPlane, ButtonPuff, ButtonRoll, ButtonSparks, ButtonTick, EdgeBurst, QUIET_PILL, buttonBase, buttonIntents, buttonResults, buttonRollLayer, buttonSizes, buttonSquare, play, ButtonRollState, useButtonRoll), which it now uses. Ships feedback.ts (FeedbackEvent, FeedbackProps), which it now uses. Ships motion.ts (EASE, lessMotion, roleTiming, useLessMotion), which it now uses. Ships portal.ts (useStagePlacement), which it now uses.
v1.0.0 · 2026-11-09
Released free with the Notchset system.