Anatomy
Usage
For most use cases, you can use <DialogCard>
to display a dialog with a title, description, and optional icon. Compose <Dialog>
, <DialogTrigger>
, <DialogContent>
, and <DialogCard>
.
Orientation
To display the icon above the content and center text, set orientation
to "vertical"
. It’s recommended to also set actionDirection
to "center"
or "stacked"
.
Widths
To set the width of the dialog, pass a className
to <DialogContent>
.
Without close button
A close button will display in the top right by default. To remove it, pass hideClose
to <DialogContent>
.
Footer background
To display a well background in the footer, set variant
to "well"
in <DialogFooter>
.
API Reference
Dialog
The root dialog component.
Prop | Type | Default |
---|---|---|
defaultOpen | boolean | |
modal | boolean | true |
onOpenChange | (open: boolean) => void | |
open | boolean |
DialogTrigger
A component that triggers the dialog to open when clicked.
Inherits properties from HTMLButtonElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | |
children | ReactNode |
DialogContent
Contains content to be rendered in the open dialog.
Inherits properties from HTMLElement
.
Prop | Type | Default |
---|---|---|
children | ReactNode | |
className | string | |
hideClose | boolean | |
img | string | |
imgAltText | string |
DialogHeader
A container for DialogTitle
and DialogDescription
.
Prop | Type | Default |
---|---|---|
className | string |
DialogTitle
Inherits properties from HTMLHeadingElement
.
Prop | Type | Default |
---|---|---|
className | string |
DialogDescription
Inherits properties from HTMLParagraphElement
.
Prop | Type | Default |
---|---|---|
className | string |
DialogFooter
Inherits properties from HTMLDivElement
.
Prop | Type | Default |
---|---|---|
actionDirection | "left" "right" "center" "stacked" | "right" |
className | string | |
orientation | "horizontal" "vertical" | "horizontal" |
primaryActionProps | ButtonProps | |
secondaryActionProps | ButtonProps | |
variant | "default" "well" | "default" |
DialogCard
Composes DialogHeader
, DialogTitle
, DialogDescription
, and DialogFooter
into a single component with a predefined layout.
Prop | Type | Default |
---|---|---|
title | string | |
actionDirection | "left" "right" "center" "stacked" | "right" |
className | string | |
description | string ReactNode | |
icon | IconDefinition | |
orientation | "horizontal" "vertical" | "horizontal" |
primaryActionProps | ButtonProps | |
secondaryActionProps | ButtonProps | |
variant | "info" "destructive" "warning" "success" |