Dialog
A focused surface for decisions that need attention.
npx shadcn@latest add @silicon-ui/dialogInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/dialogManually
Install the dependencies
npm install @radix-ui/react-dialog lucide-react motionCopy these files into your project
- components/silicon-ui/dialog/dialog.tsx
- components/silicon-ui/dialog/dialog.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/lib/escape.ts
- components/silicon-ui/lib/return-focus.ts
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
Dialog
Accepts the props of DialogProps.
DialogContent
| Prop | Type | Default |
|---|---|---|
title* | string | — |
children* | ReactNode | — |
descriptionPlain text swaps in with a rise when it changes; markup (a bold id) is shown as given. | ReactNode | — |
hideHeaderKeep the title and optional description available to assistive technology without drawing a header or close button. | boolean | false |
placementPlace the dialog near the top of the viewport; centered by default. | "center" | "top" | "center" |
Also accepts the props of ComponentPropsWithoutRef<typeof DialogPrimitive.Content>.
DialogTrigger
Accepts the props of ButtonHTMLAttributes.
DialogClose
Accepts the props of ButtonHTMLAttributes.