Large
Wider surface for denser content.
<Dialog>
<Dialog.Trigger render={<Button>Open large dialog</Button>} />
<Dialog.Content width="lg">
<Dialog.Close />
<Dialog.Header>
<Dialog.Title>Detailed settings</Dialog.Title>Blocks the page with one focused task the user finishes or dismisses.
<Dialog>
<Dialog.Trigger render={<Button>Open dialog</Button>} />
<Dialog.Content>
<Dialog.Close />
<Dialog.Header>
<Dialog.Title>Dialog title</Dialog.Title>Do not use a Dialog for a non-blocking notification.
Don’t
<Dialog>Saved</Dialog>Do
<Alert tone="info">
<Alert.Icon />
<Alert.Body>
<Alert.Title>Settings sync pending</Alert.Title>
<Alert.Content>Changes reach every workspace within a minute.</Alert.Content>
</Alert.Body>
</Alert>Do not omit an accessible title and explicit close action from a Dialog.
Don’t
<Dialog><Dialog.Content>Focused task</Dialog.Content></Dialog>Do
<Dialog defaultOpen>
<Dialog.Content>
<Dialog.Title>Account settings</Dialog.Title>
<Dialog.Body>Update your workspace preferences.</Dialog.Body>
<Dialog.Close>Close</Dialog.Close>
</Dialog.Content>
</Dialog>pnpm add @usefragments/uiImport styles once from @usefragments/ui/styles. See the installation guide for framework and theme setup.
Import Dialog once, then compose its parts with dot notation.
Dialog.TriggerDialog.ContentDialog.CloseDialog.HeaderDialog.TitleDialog.DescriptionDialog.BodyDialog.FooterHeader, body, and footer in the standard layout.
<Dialog>
<Dialog.Trigger render={<Button>Open dialog</Button>} />
<Dialog.Content>
<Dialog.Close />
<Dialog.Header>
<Dialog.Title>Dialog title</Dialog.Title>
<Dialog.Description>Focused supporting content.</Dialog.Description>
</Dialog.Header>
<Dialog.Body>Dialog body</Dialog.Body>
<Dialog.Footer>
<Dialog.Close render={<Button variant="ghost">Close</Button>} />
</Dialog.Footer>
</Dialog.Content>
</Dialog>Wider surface for denser content.
<Dialog>
<Dialog.Trigger render={<Button>Open large dialog</Button>} />
<Dialog.Content width="lg">
<Dialog.Close />
<Dialog.Header>
<Dialog.Title>Detailed settings</Dialog.Title>Skips autofocus when you place focus yourself.
<Dialog>
<Dialog.Trigger render={<Button variant="soft">Open settings</Button>} />
<Dialog.Content initialFocus={false}>
<Dialog.Header>
<Dialog.Title>Settings</Dialog.Title>
<Dialog.Description>Choose a settings area to edit.</Dialog.Description>A wrapping title keeps the close control reachable.
<Dialog>
<Dialog.Trigger render={<Button>Open long title dialog</Button>} />
<Dialog.Content>
<Dialog.Close />
<Dialog.Header>
<Dialog.Title>Prop | Type | Default | Description |
|---|---|---|---|
Body.childrenRequired | React.ReactNode | Not set | — |
childrenRequired | React.ReactNode | Not set | — |
Content.childrenRequired | React.ReactNode | Not set | — |
Content.finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) | undefined | Not set | Where focus goes when the dialog closes. |
Content.initialFocus | boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | HTMLElement | null | void) | undefined | Not set | Where focus goes when the dialog opens. |
Content.width | DialogWidth | undefinedsmmdlg | Not set | Sheet width. |
defaultOpen | boolean | undefined | Not set | Default open state |
Description.childrenRequired | React.ReactNode | Not set | — |
Footer.childrenRequired | React.ReactNode | Not set | — |
Header.childrenRequired | React.ReactNode | Not set | — |
onOpenChange | ((open: boolean) => void) | undefined | Not set | Called when the open state changes |
open | boolean | undefined | Not set | Controlled open state |
Title.childrenRequired | React.ReactNode | Not set | — |