Components
Dialog
Expressive modal dialog with spring scale motion, solid surface ring, scrollable panel, nested stacking, and mobile fullscreen mode.
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Field, FieldLabel } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
export default function Particle() {
return (
<Dialog>
<DialogTrigger render={<Button variant="outline" />}>
Open Dialog
</DialogTrigger>
<DialogPopup className="sm:max-w-sm">
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when you're done.
</DialogDescription>
</DialogHeader>
<Form className="contents">
<DialogPanel className="grid gap-4">
<Field>
<FieldLabel>Name</FieldLabel>
<Input defaultValue="Margaret Welsh" type="text" />
</Field>
<Field>
<FieldLabel>Username</FieldLabel>
<Input defaultValue="@maggie.welsh" type="text" />
</Field>
</DialogPanel>
<DialogFooter>
<DialogClose render={<Button variant="ghost" />}>
Cancel
</DialogClose>
<Button type="submit">Save</Button>
</DialogFooter>
</Form>
</DialogPopup>
</Dialog>
);
}
Installation
pnpm dlx shadcn@latest add @taut-ui/dialog
Usage
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogPopup>
<DialogHeader>
<DialogTitle>Edit workspace</DialogTitle>
<DialogDescription>Update your workspace settings.</DialogDescription>
</DialogHeader>
<DialogPanel>{/* content */}</DialogPanel>
<DialogFooter>
<DialogClose>Cancel</DialogClose>
</DialogFooter>
</DialogPopup>
</Dialog>Examples
From Menu
"use client";
import { MoreHorizontalIcon, Trash2Icon, UserPlusIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPopup,
DialogTitle,
} from "@/components/ui/dialog";
import {
Menu,
MenuItem,
MenuPopup,
MenuSeparator,
MenuTrigger,
} from "@/components/ui/menu";
export default function Particle() {
const [open, setOpen] = useState(false);
return (
<div className="flex items-center justify-center">
<Menu>
<MenuTrigger
render={
<Button size="icon-sm" variant="outline">
<MoreHorizontalIcon />
</Button>
}
/>
<MenuPopup align="center">
<MenuItem>
<UserPlusIcon className="size-4" />
<span>Invite members</span>
</MenuItem>
<MenuSeparator />
<MenuItem onClick={() => setOpen(true)} variant="destructive">
<Trash2Icon className="size-4" />
<span>Delete project</span>
</MenuItem>
</MenuPopup>
</Menu>
<Dialog onOpenChange={setOpen} open={open}>
<DialogPopup className="sm:max-w-md" showCloseButton>
<DialogHeader>
<DialogTitle>Delete project</DialogTitle>
<DialogDescription>
Are you sure you want to delete this project? All associated data,
repositories, and deployments will be permanently removed.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<DialogClose render={<Button variant="ghost" />}>
Cancel
</DialogClose>
<Button onClick={() => setOpen(false)} variant="destructive">
Delete permanently
</Button>
</DialogFooter>
</DialogPopup>
</Dialog>
</div>
);
}
Nested Dialog
"use client";
import { KeyIcon, ShieldCheckIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Field, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
export default function Particle() {
const [nestedOpen, setNestedOpen] = useState(false);
return (
<Dialog>
<DialogTrigger render={<Button variant="outline" />}>
Project Settings
</DialogTrigger>
<DialogPopup className="sm:max-w-md" showCloseButton>
<DialogHeader>
<DialogTitle>Project Settings</DialogTitle>
<DialogDescription>
Manage team access, security policies, and API keys.
</DialogDescription>
</DialogHeader>
<DialogPanel className="space-y-4">
<div className="flex items-center justify-between rounded-2xl border p-4">
<div className="space-y-0.5">
<p className="font-medium text-foreground text-sm">
API Credentials
</p>
<p className="text-muted-foreground text-xs">
Active keys used in production environments.
</p>
</div>
<Button
onClick={() => setNestedOpen(true)}
size="sm"
variant="secondary"
>
<KeyIcon className="size-3.5" />
Generate
</Button>
</div>
<div className="flex items-center justify-between rounded-2xl border p-4">
<div className="space-y-0.5">
<p className="font-medium text-foreground text-sm">
Two-Factor Auth
</p>
<p className="text-muted-foreground text-xs">
Enforce 2FA for all organization members.
</p>
</div>
<ShieldCheckIcon className="size-5 text-primary" />
</div>
</DialogPanel>
<DialogFooter>
<DialogClose render={<Button />}>Close</DialogClose>
</DialogFooter>
{/* Nested Dialog */}
<Dialog onOpenChange={setNestedOpen} open={nestedOpen}>
<DialogPopup className="sm:max-w-sm" showCloseButton>
<DialogHeader>
<DialogTitle>Create API Key</DialogTitle>
<DialogDescription>
Provide a name for your API key. It will only be visible once.
</DialogDescription>
</DialogHeader>
<DialogPanel className="space-y-3">
<Field>
<FieldLabel>Key Name</FieldLabel>
<Input
defaultValue="Production Service Key"
placeholder="e.g. CI/CD"
/>
</Field>
</DialogPanel>
<DialogFooter>
<DialogClose render={<Button variant="ghost" />}>
Cancel
</DialogClose>
<Button onClick={() => setNestedOpen(false)}>Create Key</Button>
</DialogFooter>
</DialogPopup>
</Dialog>
</DialogPopup>
</Dialog>
);
}
Close Confirmation
"use client";
import { useState } from "react";
import {
AlertDialog,
AlertDialogClose,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogPopup,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Field } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Textarea } from "@/components/ui/textarea";
export default function Particle() {
const [dialogOpen, setDialogOpen] = useState(false);
const [confirmOpen, setConfirmOpen] = useState(false);
const [value, setValue] = useState("");
return (
<Dialog
onOpenChange={(o) => {
if (!o && value) {
setConfirmOpen(true);
} else {
setDialogOpen(o);
}
}}
open={dialogOpen}
>
<DialogTrigger render={<Button variant="outline" />}>
Compose
</DialogTrigger>
<DialogPopup showCloseButton={false}>
<DialogHeader>
<DialogTitle>New message</DialogTitle>
<DialogDescription>Type something and try closing.</DialogDescription>
</DialogHeader>
<Form
className="contents"
onSubmit={(event) => {
event.preventDefault();
setDialogOpen(false);
}}
>
<DialogPanel>
<Field>
<Textarea
onChange={(e) => setValue(e.target.value)}
placeholder="Write your message…"
value={value}
/>
</Field>
</DialogPanel>
<DialogFooter>
<DialogClose render={<Button variant="ghost" />}>
Cancel
</DialogClose>
<Button
onClick={() => {
setValue("");
setDialogOpen(false);
}}
>
Send
</Button>
</DialogFooter>
</Form>
</DialogPopup>
<AlertDialog onOpenChange={setConfirmOpen} open={confirmOpen}>
<AlertDialogPopup>
<AlertDialogHeader>
<AlertDialogTitle>Discard changes?</AlertDialogTitle>
<AlertDialogDescription>
Your unsaved message will be permanently lost.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogClose render={<Button variant="ghost" />}>
Keep editing
</AlertDialogClose>
<Button
onClick={() => {
setConfirmOpen(false);
setValue("");
setDialogOpen(false);
}}
variant="destructive"
>
Discard
</Button>
</AlertDialogFooter>
</AlertDialogPopup>
</AlertDialog>
</Dialog>
);
}
Scrollable Content
import { FileTextIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { ScrollArea } from "@/components/ui/scroll-area";
export default function Particle() {
return (
<Dialog>
<DialogTrigger render={<Button variant="outline" />}>
<FileTextIcon className="size-4" />
View Terms of Service
</DialogTrigger>
<DialogPopup className="sm:max-w-lg" showCloseButton>
<DialogHeader>
<DialogTitle>Terms of Service</DialogTitle>
<DialogDescription>
Please read these terms and conditions carefully before using our
services.
</DialogDescription>
</DialogHeader>
<DialogPanel className="overflow-hidden p-0">
<ScrollArea className="h-72 px-6" scrollFade>
<div className="space-y-4 py-3 text-xs leading-relaxed">
<section className="space-y-1.5">
<h4 className="font-semibold text-foreground text-sm">
1. Acceptance of Terms
</h4>
<p>
By accessing or using our platform, you agree to be bound by
these Terms. If you disagree with any part of the terms, you
may not access the service.
</p>
</section>
<section className="space-y-1.5">
<h4 className="font-semibold text-foreground text-sm">
2. User Accounts & Security
</h4>
<p>
When you create an account with us, you must provide accurate
and complete information. You are responsible for safeguarding
the password that you use to access the service and for any
activities or actions under your password.
</p>
<p>
You agree not to disclose your password to any third party.
You must notify us immediately upon becoming aware of any
breach of security or unauthorized use of your account.
</p>
</section>
<section className="space-y-1.5">
<h4 className="font-semibold text-foreground text-sm">
3. Intellectual Property
</h4>
<p>
The Service and its original content, features, and
functionality are and will remain the exclusive property of
our organization and its licensors. Our trademarks may not be
used in connection with any product or service without prior
written consent.
</p>
</section>
<section className="space-y-1.5">
<h4 className="font-semibold text-foreground text-sm">
4. Termination
</h4>
<p>
We may terminate or suspend your account immediately, without
prior notice or liability, for any reason whatsoever,
including without limitation if you breach the Terms.
</p>
</section>
<section className="space-y-1.5">
<h4 className="font-semibold text-foreground text-sm">
5. Limitation of Liability
</h4>
<p>
In no event shall the company, nor its directors, employees,
partners, agents, suppliers, or affiliates, be liable for any
indirect, incidental, special, consequential, or punitive
damages.
</p>
</section>
</div>
</ScrollArea>
</DialogPanel>
<DialogFooter>
<DialogClose render={<Button variant="ghost" />}>Decline</DialogClose>
<DialogClose render={<Button />}>I Accept</DialogClose>
</DialogFooter>
</DialogPopup>
</Dialog>
);
}
With Icon
import { RocketIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogDescription,
DialogFooter,
DialogHeader,
DialogIcon,
DialogPanel,
DialogPopup,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
export default function Particle() {
return (
<Dialog>
<DialogTrigger render={<Button variant="tonal" />}>
<RocketIcon className="size-4" />
Upgrade to Pro
</DialogTrigger>
<DialogPopup className="sm:max-w-sm" showCloseButton>
<DialogHeader>
<DialogIcon>
<RocketIcon />
</DialogIcon>
<DialogTitle>Unlock Taut Pro</DialogTitle>
<DialogDescription>
Take your interfaces to the next level with advanced fluid motions,
custom sound design, and priority support.
</DialogDescription>
</DialogHeader>
<DialogPanel>
<div className="flex flex-col gap-1">
<div className="flex items-center justify-between rounded-xl bg-[color-mix(in_oklab,var(--color-popover),var(--color-foreground)_5%)] px-4 py-3 text-xs first:rounded-t-2xl dark:bg-card">
<span className="text-muted-foreground">Billing Cycle</span>
<span className="font-medium text-foreground">
Annual ($12/mo)
</span>
</div>
<div className="flex items-center justify-between rounded-xl bg-[color-mix(in_oklab,var(--color-popover),var(--color-foreground)_5%)] px-4 py-3 text-xs last:rounded-b-2xl dark:bg-card">
<span className="text-muted-foreground">Workspace Seats</span>
<span className="font-medium text-foreground">Unlimited</span>
</div>
</div>
</DialogPanel>
<DialogFooter className="justify-center sm:justify-between">
<DialogClose render={<Button variant="ghost" />}>
Maybe later
</DialogClose>
<Button>Start 14-Day Free Trial</Button>
</DialogFooter>
</DialogPopup>
</Dialog>
);
}
API Reference
Dialog
Re-exports Dialog.Root from @base-ui/react/dialog.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Controlled open state |
defaultOpen | boolean | false | Initial uncontrolled open state |
onOpenChange | (open: boolean) => void | - | Called when the open state changes |
modal | boolean | "trap-focus" | true | Blocks outside interaction and traps focus |
DialogPopup / DialogContent
Composes DialogPortal, DialogBackdrop, DialogViewport, and Dialog.Popup.
| Prop | Type | Default | Description |
|---|---|---|---|
showCloseButton | boolean | false | Renders a top-right ghost close button |
fullscreenOnMobile | boolean | false | Expands to full screen on viewports below sm |
closeProps | Dialog.Close.Props | - | Props forwarded to the built-in close button |
portalProps | Dialog.Portal.Props | - | Props forwarded to the internal DialogPortal |
className | string | - | Additional CSS classes |
DialogPanel
Scrollable body container with overscroll containment and thin scrollbar styling.
| Prop | Type | Default | Description |
|---|---|---|---|
render | React.ReactElement | - | Custom element to render instead of <div> |
className | string | - | Additional CSS classes |
DialogHeader / DialogIcon / DialogTitle / DialogDescription / DialogFooter / DialogTrigger / DialogClose
Composable header, centered icon slot (DialogIcon), accessible typography, and action footer primitives.