Dialog
Storybook
Go to StoryDialog
const Dialog: FC<DialogProps> = DialogPrimitive.Root;
Defined in: src/components/Dialog/Dialog.tsx:67
Main wrapper for Dialog functionality.
Dialogs are used to present content that requires user interaction while temporarily blocking interaction with the main content.
Dialogs are composed using smaller components to ensure high customization yet maintaining consistency.
Built on top of radix-ui Dialog
Examples
// Basic usage with DialogTrigger
<Dialog>
<DialogTrigger>Open Settings</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Settings</DialogTitle>
<DialogDescription>
Configure your application preferences
</DialogDescription>
</DialogHeader>
<div className="space-y-4">
content
</div>
<DialogFooter>
<Button variant="outline">Reset</Button>
<Button>Save Changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
// Controlled dialog
const [open, setOpen] = useState(false);
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger>View Profile</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>User Profile</DialogTitle>
</DialogHeader>
<div className="space-y-4">
content
</div>
</DialogContent>
</Dialog>
DialogTrigger
const DialogTrigger: ForwardRefExoticComponent<DialogTriggerProps & RefAttributes<HTMLButtonElement>> = DialogPrimitive.Trigger;
Defined in: src/components/Dialog/Dialog.tsx:69
DialogPortal
const DialogPortal: FC<DialogPortalProps> = DialogPrimitive.Portal;
Defined in: src/components/Dialog/Dialog.tsx:71
DialogClose
const DialogClose: ForwardRefExoticComponent<DialogCloseProps & RefAttributes<HTMLButtonElement>> = DialogPrimitive.Close;
Defined in: src/components/Dialog/Dialog.tsx:73
DialogCloseX()
function DialogCloseX(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:88
A styled close button with an X icon for Dialog components. Positioned in the top-right corner of a Dialog by default.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogCloseProps & RefAttributes<HTMLButtonElement> |
Returns
Element
Example
<DialogContent>
<DialogTitle>Settings</DialogTitle>
<DialogCloseX />
<p>Dialog content...</p>
</DialogContent>
DialogOverlay()
function DialogOverlay(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:107
Displays overlay behind the main dialog content. Necessary to achieve dialog's modality.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogOverlayProps & RefAttributes<HTMLDivElement> |
Returns
Element
DialogContentElement()
function DialogContentElement(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:133
Ready to use DialogContent. Provides default modality styling and size constraints. .
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogContentElementProps |
Returns
Element
DialogContent()
function DialogContent(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:177
The main content container for the Dialog. Provides complete Dialog experience with reasonable defaults.
Handles portal, overlay, size constraints, close button, centered positioning, animations. If Dialog has more specified needs, it has to opt out from this component and use primitives directly.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogContentProps |
Returns
Element
Examples
// Basic usage
<DialogContent>
<DialogTitle>Dialog Title</DialogTitle>
<p>Dialog content</p>
</DialogContent>
// With custom size
<DialogContent size="sm">
<DialogTitle>Small Dialog</DialogTitle>
</DialogContent>
DialogHeader()
function DialogHeader(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:205
Container for dialog header elements.
Typically contains DialogTitle and optionally DialogDescription components.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DetailedHTMLProps<HTMLAttributes<HTMLDivElement>> |
Returns
Element
Example
<DialogHeader>
<DialogTitle>Settings</DialogTitle>
<DialogDescription>Configure your preferences</DialogDescription>
</DialogHeader>
DialogFooter()
function DialogFooter(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:233
Container for Dialog footer elements.
Provides consistent spacing and layout for dialog actions like buttons. On mobile, buttons are stacked with primary action on top. On desktop, buttons are placed side-by-side with right alignment.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DetailedHTMLProps<HTMLAttributes<HTMLDivElement>> |
Returns
Element
Example
<DialogFooter>
<Button variant="outline">Cancel</Button>
<Button>Save Changes</Button>
</DialogFooter>
DialogTitle()
function DialogTitle(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:265
Title component for Dialog.
Automatically sets the correct ARIA attributes for accessibility. Renders a semantically marked heading for the dialog content. Required for accessibility but can be visually hidden if necessary.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogTitleProps & RefAttributes<HTMLHeadingElement> |
Returns
Element
Examples
<DialogTitle>Account Settings</DialogTitle>
// hidden visually
<DialogTitle className="hidden">Account Settings</DialogTitle>
DialogDescription()
function DialogDescription(__namedParameters): Element;
Defined in: src/components/Dialog/Dialog.tsx:289
Description component for Dialog.
Provides additional context or explanation below the DialogTitle. Automatically sets the correct ARIA attributes for accessibility. Rendered with muted styling to create visual hierarchy.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | DialogDescriptionProps & RefAttributes<HTMLParagraphElement> |
Returns
Element
Example
<DialogDescription>
Make changes to your profile information. Your data will be updated across all services.
</DialogDescription>