Introducing PrimeReact v11-alpha 🎉Discover Now

Dialog

An unstyled modal dialog component with built-in focus trap, scroll lock, drag support, and dismissable backdrop.

Build fully custom modal dialogs with complete control over layout and styling.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use Dialog with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with sub-components: Root, Trigger, Portal, Backdrop, Positioner, Popup, Header, Title, HeaderActions, Maximizable, Close, Content, Footer
  • Nine position modes: center, top, bottom, left, right, topleft, topright, bottomleft, bottomright
  • Integrated focus trap with automatic focus management on open and close
  • Dismissable Backdrop with click-outside detection
  • Built-in drag support with viewport boundary enforcement
  • Maximizable mode with fullscreen toggle
  • Scroll lock support via blockScroll

Usage#

import { Dialog } from 'primereact/dialog';
<Dialog.Root>
    <Dialog.Trigger></Dialog.Trigger>
    <Dialog.Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
            <Dialog.Popup>
                <Dialog.Header>
                    <Dialog.Title></Dialog.Title>
                    <Dialog.HeaderActions>
                        <Dialog.Maximizable></Dialog.Maximizable>
                        <Dialog.Close></Dialog.Close>
                    </Dialog.HeaderActions>
                </Dialog.Header>
                <Dialog.Content></Dialog.Content>
                <Dialog.Footer></Dialog.Footer>
            </Dialog.Popup>
        </Dialog.Positioner>
    </Dialog.Portal>
</Dialog.Root>

Behavior#

Motion Animation#

<Dialog.Popup motionProps={{ name: 'p-dialog', appear: true }}>...</Dialog.Popup>

See Motion for animation phases, CSS variables, and hide strategies.

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<Dialog.Trigger as="div">...</Dialog.Trigger>
<Dialog.Close as="a">...</Dialog.Close>

Default elements: Root=div, Trigger=button, Positioner=div, Popup=div, Header=div, Title=div, HeaderActions=div, Maximizable=button, Close=button, Content=div, Footer=div.

Render Function Children#

Sub-components accept a render function as children, providing access to the component instance.

<Dialog.Content>{(instance) => <div>{instance.dialog?.state.open ? 'Open' : 'Closed'}</div>}</Dialog.Content>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

DialogRoot#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogRootInstance—
The instance to pass to the component.
ptSafeRecord<DialogRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
openboolean—
Specifies the visibility of the dialog.
defaultOpenboolean—
Specifies the default visibility of the dialog.
draggablebooleantrue
Enables dragging to change the position using header.
keepInViewportbooleantrue
Keeps dialog in the viewport.
minXnumber0
Minimum value for the left coordinate of dialog in dragging.
minYnumber0
Minimum value for the top coordinate of dialog in dragging.
trappedbooleantrue
When enabled, focus is trapped within the dialog (modal behavior).
dismissablebooleanfalse
Specifies if clicking the modal background should hide the dialog.
closeOnEscapebooleantrue
Specifies if pressing escape key should hide the dialog.
blockScrollbooleanfalse
Whether background scroll should be blocked when dialog is visible.
baseZIndexnumber0
Base zIndex value to use in layering.
autoZIndexbooleantrue
Whether to automatically manage layering.
appendTo"body" | HTMLElement | "self"body
A valid query selector or an HTMLElement to specify where the dialog gets attached.
position"center" | "top" | "bottom" | "left" | "right" | "topleft" | "topright" | "bottomleft" | "bottomright"center
Position of the dialog.
fullScreenbooleanfalse
Whether the dialog should open in full screen (maximized) mode.
onOpenChange(event: DialogRootChangeEvent) => void—
Callback function that is called when the trigger is clicked.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-openPresent when the dialog is open
data-closedPresent when the dialog is closed
data-maximizedPresent when the dialog is maximized

Defines passthrough(pt) options of Dialog component.

labeltypedescription
rootDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
backdropDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the backdrop's DOM element.
triggerDialogRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the trigger's DOM element.
headerDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the header's DOM element.
titleDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the title's DOM element.
headerActionsDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the headerActions's DOM element.
maximizableDialogRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the maximizable's DOM element.
closeDialogRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the close's DOM element.
contentDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the content's DOM element.
footerDialogRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the footer's DOM element.

DialogTrigger#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogTriggerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogTriggerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogTriggerInstance—
The instance to pass to the component.
ptSafeRecord<DialogTriggerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogTriggerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-openPresent when the dialog is open
data-closedPresent when the dialog is closed

Defines passthrough(pt) options of DialogTrigger component.

labeltypedescription
rootDialogTriggerPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

DialogPortal#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogPortalInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogPortalInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogPortalInstance—
The instance to pass to the component.
ptSafeRecord<DialogPortalPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogPortalInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogPortal component.

labeltypedescription
rootDialogPortalPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

DialogBackdrop#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogBackdropInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogBackdropInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogBackdropInstance—
The instance to pass to the component.
ptSafeRecord<DialogBackdropPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogBackdropInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Uses the Backdrop component internally for animated overlay rendering.

Defines passthrough(pt) options of DialogBackdrop component.

labeltypedescription
rootDialogBackdropPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogPositioner#

AttributeValue
data-position"center" | "top" | "bottom" | "left" | "right" | "topleft" | "topright" | "bottomleft" | "bottomright"
data-scroll-behavior"inside" | "outside"
data-openPresent when the dialog is open
data-closedPresent when the dialog is closed
data-maximizedPresent when the dialog is maximized

DialogPopup#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogPopupInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogPopupInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogPopupInstance—
The instance to pass to the component.
ptSafeRecord<DialogPopupPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogPopupInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-openPresent when the dialog is open
data-maximizedPresent when the dialog is maximized

Uses VisuallyHidden elements internally for focus trap boundaries.

Defines passthrough(pt) options of DialogPopup component.

labeltypedescription
rootDialogPopupPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogHeader#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogHeaderInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogHeaderInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogHeaderInstance—
The instance to pass to the component.
ptSafeRecord<DialogHeaderPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogHeaderInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogHeader component.

labeltypedescription
rootDialogHeaderPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogTitle#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogTitleInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogTitleInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogTitleInstance—
The instance to pass to the component.
ptSafeRecord<DialogTitlePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogTitleInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogTitle component.

labeltypedescription
rootDialogTitlePassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogHeaderActions#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogHeaderActionsInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogHeaderActionsInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogHeaderActionsInstance—
The instance to pass to the component.
ptSafeRecord<DialogHeaderActionsPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogHeaderActionsInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogHeaderActions component.

labeltypedescription
rootDialogHeaderActionsPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogMaximizable#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogMaximizableInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogMaximizableInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogMaximizableInstance—
The instance to pass to the component.
ptSafeRecord<DialogMaximizablePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogMaximizableInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
iconOnlybooleantrue
Whether to show the DialogMaximizable with a borderless style.
severitystring & {} | "secondary" | "info" | "success" | "warn" | "danger" | "contrast" | "help"'secondary'
Severity type of the DialogMaximizable.
variant"link" | "text" | "outlined"'text'
Variant of the DialogMaximizable.
roundedbooleantrue
Whether to show the DialogMaximizable with a rounded style.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-maximizedPresent when the dialog is maximized
data-minimizedPresent when the dialog is not maximized

Defines passthrough(pt) options of DialogMaximizable component.

labeltypedescription
rootDialogMaximizablePassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

DialogClose#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogCloseInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogCloseInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogCloseInstance—
The instance to pass to the component.
ptSafeRecord<DialogClosePassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogCloseInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
iconOnlybooleantrue
Whether to show the DialogClose with a borderless style.
severitystring & {} | "secondary" | "info" | "success" | "warn" | "danger" | "contrast" | "help"'secondary'
Severity type of the DialogClose.
variant"link" | "text" | "outlined"'text'
Variant of the DialogClose.
roundedbooleantrue
Whether to show the DialogClose with a rounded style.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogClose component.

labeltypedescription
rootDialogClosePassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

DialogContent#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogContentInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogContentInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogContentInstance—
The instance to pass to the component.
ptSafeRecord<DialogContentPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogContentInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-maximizedPresent when the dialog is maximized

Defines passthrough(pt) options of DialogContent component.

labeltypedescription
rootDialogContentPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

DialogFooter#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: DialogFooterInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: DialogFooterInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceDialogFooterInstance—
The instance to pass to the component.
ptSafeRecord<DialogFooterPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: DialogFooterInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.

Defines passthrough(pt) options of DialogFooter component.

labeltypedescription
rootDialogFooterPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

Dialog component uses dialog role along with aria-labelledby referring to the header element however any attribute is passed to the root element so aria-labelledby can be used to override this default behavior. In addition aria-modal is added since focus is kept within the popup.

Trigger element also has aria-expanded and aria-controls to indicate the dialog state.

Overlay Keyboard Support#

KeyFunction
tabMoves focus to the next the focusable element within the dialog if modal is true. Otherwise, the focusable element in the page tab sequence.
shift + tabMoves focus to the previous the focusable element within the dialog if modal is true. Otherwise, the focusable element in the page tab sequence.
escapeCloses the dialog if closeOnEscape is true.

Close Button Keyboard Support#

KeyFunction
enterCloses the dialog.
spaceCloses the dialog.