Shadcn.io is not affiliated with official shadcn/ui
Shadcn Dialog
React dialog for profile forms, share sheets, and settings. Built with TypeScript and Tailwind CSS for Next.js using Base UI — focus trap and a required title.
A dialog sits over the page and makes everything else inert. Use it for a short form, a share link, or settings that need an answer before they go back. If they only pick yes or no, that is an Alert Dialog.
Looking for a neobrutalism version for shadcn?
Same dialog, thicker borders. The NeoBrutalism dialog is the kit if you want that look.
Usage
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Edit profile</DialogTitle>
<DialogDescription>
This can't be undone. The account is deleted from the servers.
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>Put render={<Button />} on the trigger so the Button is the actual control. DialogTitle is required — screen readers announce it when the overlay opens.
Composition
Custom Close Button
Replace the default X with DialogClose around your own button.
No Close Button
showCloseButton={false} hides the top-right X. Overlay click and Escape still dismiss it.
Sticky Footer
Keep DialogFooter outside the scroll region so Save stays on screen.
Scrollable Content
Put max-h-[50vh] overflow-y-auto on the body. The header stays put.
RTL
Wrap with DirectionProvider and dir="rtl". Header text and footer buttons follow the reading direction.
API
Prop
Type
DialogContent
Prop
Type
DialogFooter
Prop
Type
DialogTrigger and DialogClose take render.
Keyboard
| Key | Action |
|---|---|
Space / Enter | Open from the trigger, or fire the focused button |
Escape | Close and return focus to the trigger |
Tab / Shift + Tab | Cycle controls inside the dialog |
Focus stays in the overlay until it closes. Title and description are announced.
Notes
Hiding the X is not a lock
showCloseButton={false} still dismisses on overlay click and Escape. Prevent those events if they have to finish the form.
Name the action on the footer button. After it succeeds, a Sonner toast is enough.
With other components
Trigger and footer actions
FormFields inside the overlay
FieldLabel stacked with input
InputName, username, link
LabelVisible or screen-reader only
DirectionMirror the overlay
Questions
Related
Was this page helpful?
Sign in to leave feedback.
Date Picker
React date picker for forms, bookings, and filters. Built with TypeScript and Tailwind CSS for Next.js using Popover and Calendar — single dates, ranges, and time.
Direction
React direction provider for Arabic, Hebrew, and Persian pages. Built with TypeScript and Tailwind CSS for Next.js using Base UI — one context so menus and sliders flip.