Dialog

Displays a modal window above the page contents.

This component inherits parts and props from the Radix Dialog primitive. View source

Contains all the parts of a dialog.

Wraps the control that will open the dialog.

Contains content to be rendered in the open dialog. This component is based on the div element.

PropTypeDefault
size '1' | '2' | '3' | '4' | '5' | '6'

The size prop will map to the following widths:

SizeMax Width
1430px
2530px
3600px
4680px
5780px
6900px
PropTypeDefault
titleReact.ReactNoderequired
descriptionReact.ReactNode
errorReact.ReactNode
childrenReact.ReactNodenull

Contains the main content of the dialog – it has a built-in scroll area that is only visible when the content is too big to fit in the dialog.

Contains the actions of the dialog.

Wraps the control that will close the dialog.

The Title component is deprecated and it should be used only on very specific cases. Use the title prop instead.

An accessible title that is announced when the dialog is opened. This part is based on the Heading component with a pre-defined font size and leading trim on top.

The Description component is deprecated and it should be used only on very specific cases. Use the description prop instead.

An optional accessible description that is announced when the dialog is opened. This part is based on the Text component with a pre-defined font size.

If you want to remove the description entirely, remove this part and pass aria-describedby={undefined} to Dialog.Content.

Use the size prop in the Content component to control the maxWidth of the dialog. If you have a very specific case, you can still pass a custom maxWidth prop to override the size.

Use the Inset component to create a container that ignores the Content part padding. If needed, you can recreate the original padding by setting the Inset part’s padding props to "current".

Whenever the body of the dialog is bigger than the dialog itself, it will show a scrollbar automatically.

This is now deprecated. You should combine the Header, Body and Footer parts to create a scrollable content. So this example is only for reference as most of our dialogs in the dashboard still use this type of dialog.

There are a couple ways to use tables inside dialogs.

  1. You can use the Inset component without Table.Root for an edge-to-edge design
  2. Use with the Table.Root for a contained table look.

Dialogs commonly contain forms for creating or editing resources. These patterns demonstrate proper state management for loading, dirty checking, and error handling using React Hook Form.

Demonstrates how to display form submit errors within dialogs.

The loading state should always be true when the form is submitted or when the submission has succeeded AND the dialog has been closed

For edit forms only, keep the submit button disabled when the form is not dirty:

Form reset on dialog open

Place the <form> tag inside Dialog.Body and use the form attribute on submit buttons. Display form-level errors using the Dialog.Header error prop:

This approach:

  • Preserves the dialog’s flex layout structure
  • Displays errors prominently in the header

Use your resolver (like Zod) for field validation, and display errors inline.

For simple forms (using register):

For edit forms or when you need more control (using Controller):

A complete example showing how to create a dialog for adding new resources with proper form reset and loading states.

For editing existing resources, the submit button should be disabled when the form is not dirty (no changes made).