Dialog
Accessible modal dialog with focus trapping, escape-to-close and focus restoration.
npx @slipstream-ui/cli@latest add dialogPlayground
Without header close button
Sizes and composed slots
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | required | Whether the dialog is visible (controlled) |
| onOpenChange | (open: boolean) => void | required | Open/close requests |
| title | string | — | Accessible name + default header title (optional with a composed header) |
| size | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'md' | Panel max-width preset |
| header | ReactNode | — | Replaces the default header — compose DialogHeader/DialogTitle/DialogDescription |
| footer | ReactNode | — | Action row under the body |
| scrollable | boolean | false | Cap the body height and scroll inside the panel |
| description | string | - | Optional supporting text |
| closeOnBackdrop | boolean | true | Backdrop click closes the dialog |
| showClose | boolean | true | Hide the ✕ button in the header (Escape and backdrop still close) |
| initialFocusRef | RefObject<HTMLElement> | first focusable | Element focused on open |
| animate | boolean | false | Fade the backdrop and panel in/out (needs tailwindcss-animate) |
Accessibility
- role=dialog with aria-modal, labelled by title and described by description
- Initial focus moves into the dialog and returns to the opener on close
- Tab and Shift+Tab wrap inside the dialog
- Escape closes the dialog
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+ — macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA — the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.