Skip to main content

Dialogs

A dialog component for displaying modal content. Built on Radix UI primitives with overlay, animations, and focus management. Perfect for confirmations, forms, and important information.

Installation

Loading...

Import

Loading...

Usage

Use Dialog for modal content that requires user interaction. Always include DialogTitle for accessibility. Use DialogDescription for additional context. Place actions in DialogFooter. Use controlled state for programmatic control. Keep dialog content focused and concise.

Design Guidelines

Maintain consistent dialog styling throughout your application. Use appropriate max-width for content. Keep dialogs focused on a single task. Provide clear actions in the footer. Use confirmation dialogs for destructive actions. Position dialogs centrally on screen.

Basic Usage

Simple dialog with trigger

Loading...

Edit User Form

Dialog form for editing user information

Loading...

Delete Confirmation

Delete confirmation with item details

Loading...

Controlled Dialog

Dialog with controlled open state

Loading...

Full Width Content

Dialog with wider content

Loading...

Dialog

Root dialog component that manages dialog state This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
open
boolean

Controlled open state

defaultOpen
boolean

Uncontrolled default open state

onOpenChange
(open: boolean) => void

Callback fired when open state changes

className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogTrigger

Element that triggers the dialog This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

className
string

Additional CSS classes to apply to the component

DialogContent

Main content container for the dialog extends Box. This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
children
React.ReactNode

Dialog content

className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogHeader

Header section containing title and description extends Box. This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogTitle

Dialog title (required for accessibility) This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
children
React.ReactNode

Title text

className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogDescription

Dialog description text This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
children
React.ReactNode

Description text

className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogFooter

Footer section for actions extends Box. This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

DialogClose

Button that closes the dialog This component supports common style props for spacing, layout, flexbox, grid, and more. Style props export common Tailwind classes as props to help in building consistent UI. See style props documentation for details.

NameTypeDefaultDescription
className
string

Additional CSS classes to apply to the component

asChild
booleanfalse

When true, uses Radix Slot to compose functionality onto the child component instead of rendering a default element. The child component must spread props and forward refs. See Radix UI composition guide for details.

Accessibility

Accessibility features and considerations

Dialog includes proper ARIA attributes and focus management. DialogTitle is required for screen readers. Focus is trapped within the dialog when open. Escape key closes the dialog. Overlay prevents interaction with background content. Ensure dialog content is keyboard accessible.