Clinia UI

Dialog

Opens a short, focused task above the page, such as editing a record.

shadcn docs →

When to use

  • A short, focused task that belongs to this page: edit a record, create an API key.
  • Content that needs full attention before the user continues.

When not to use

  • Confirming a destructive or irreversible action: use Alert Dialog.
  • Filters or details next to the page: use Sheet.
  • A brief confirmation after an action: use Sonner.
  • A long, multi-step flow: give it its own page.

Install

npx shadcn@latest add @clinia/dialog

Anatomy

Edit profile

Changes apply to every workspace you belong to.

  1. 1Containerdata-slot="dialog-content"bg-popover · rounded-lg · p-6
  2. 2Titledata-slot="dialog-title"text-base · font-medium
  3. 3Descriptiondata-slot="dialog-description"text-sm · text-muted-foreground
  4. 4Body[data-part=body]Field
  5. 5Footerdata-slot="dialog-footer"secondary first · main last
  6. 6Close buttondata-slot="dialog-close"ghost

Clinia rules

  • The title is sentence case and names the task: Edit profile.
  • The footer puts the secondary action first and the main action last (Cancel, then Save changes). It stacks with the main action on top on small screens.
  • One default button per dialog, like any other view.

Do and don't

Edit source

Changes apply on the next sync.

Do put the secondary action first and the main action last.

Edit source

Changes apply on the next sync.

Don't lead with the main action, or the reading order flips.

States

close

Edit profile

Changes apply to every workspace.

close · hover

Edit profile

Changes apply to every workspace.

close · focus

Edit profile

Changes apply to every workspace.

long header

Invite members to Montreal clinic

Send invitations to one or more people. They get an email with a link to join.

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

Accessibility

Built in

  • Focus moves into the dialog when it opens and stays inside until it closes.
  • Escape and the close button close it, and focus returns to the element that opened it.
  • The page behind is inert while the dialog is open.

Your responsibility

  • Always render a DialogTitle. Add DialogDescription when the title alone doesn't explain the task.
  • Open it from a real button, so focus has somewhere to return.

How to test

  1. Open it with the keyboard: focus lands inside the dialog.
  2. Press Tab repeatedly: focus cycles through the dialog and never reaches the page behind.
  3. Press Escape: it closes, and focus returns to the button that opened it.
  4. With a screen reader, opening it announces a dialog and its title.

API

DialogContent

PropValuesDefaultDescription
showCloseButton
boolean
true

Shows the close button in the corner. Turn it off only when the footer has its own way out.

DialogFooter

PropValuesDefaultDescription
showCloseButton
boolean
false

Adds an outline "Close" button after the footer's children. Off by default.

All other props come from Base UI Dialog.