Modal overlays — one `<Dialog>` component with `type="default"` for content and `type="confirm"` for alerts.
npx shadcn@latest add https://sdk-components.thesqd.com/r/dialog.jsonimport { Dialog } from "@/components/ui/dialog";import { TriangleAlertIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Dialog } from "@/components/ui/dialog";
export function Example() {
return (
<Dialog
type="confirm"
trigger={
<Button>
<TriangleAlertIcon />
Delete account
</Button>
}
title="Are you absolutely sure?"
description="This action cannot be undone."
action={{ label: "Continue" }}
/>
);
}One flat component, two modes — pick via the `type` prop:
<Dialog /> (default — content dialogs, dismissable)
├── type="default" (or omit)
├── trigger={<Button>…</Button>}
├── title / description
├── footer={<>…</>} (any JSX — wrap <DialogClose render={…}> for auto-close)
├── showCloseButton (toggle the × in the corner; defaults to true)
├── sidebar={[{ label, items: [{ icon|avatar, label, description, content, action }] }]}
│ (settings-13 layout — grouped left nav + section-header panel)
├── initialFocus (ref to focus on open, or false to skip)
└── children (body)
<Dialog type="confirm" /> (alert / confirm dialogs — blocks backdrop dismiss)
├── trigger
├── title / description (rich JSX is fine)
├── cancel={{ label } | <JSX/> | false} (defaults to "Cancel"; `false` to omit)
├── action={{ label, onClick, variant } | <JSX/>}
├── media={<Icon/>} (optional featured icon above the title)
├── size="default" | "sm"
└── children (extra body between description and footer)
Need a fullscreen layout, multi-step content, or a custom close-button
position? The slot exports — `DialogRoot` and its `{Trigger, Content, Header,
Title, Description, Footer, Close, Cancel, Action, Media}` subcomponents — are
still exported as the escape hatch.Dialog (shared props)
| Prop | Type | Default | Description |
|---|---|---|---|
type | "default" | "confirm" | "default" | "default" renders a dismissable content modal with optional footer; "confirm" renders an alert-style dialog that blocks backdrop dismiss and uses `cancel` / `action`. |
trigger | ReactNode | — | Element that opens the modal — typically a `<Button>`. |
title | ReactNode | — | Heading rendered inside the header. |
description | ReactNode | — | Body copy. Pass JSX for multi-paragraph or rich content. |
size | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "md" | Container max-width — maps to Tailwind's `max-w-*` scale. Use larger sizes for content-heavy modals (file viewers, multi-column forms). |
open | boolean | — | Controlled open state (forwarded to the root primitive). |
onOpenChange | (open: boolean) => void | — | Fires when the dialog opens or closes. |
contentClassName | string | — | Extends the popup container class names (e.g. `sm:max-w-4xl!`). |
sidebar | DialogSidebarItem[] | DialogSidebarSection[] | — | Renders a settings-13 style left sidebar nav. Pass flat items or grouped sections (`{ label, items }`). Each item is `{ icon | avatar, label, description?, content?, action? }`; the active item's `label`/`description` become the page section header and its `content` (or the Dialog's `children`) the body. Pair with a wide `size`. |
children | ReactNode | — | Body content rendered between the header and footer. |
Type-specific props
| Prop | Type | Default | Description |
|---|---|---|---|
footer | ReactNode | — | (`type="default"` only) Footer content. Wrap a `<DialogClose render={<Button/>}>` to auto-close. |
showCloseButton | boolean | true | (`type="default"` only) Toggle the × close affordance in the top-right corner. |
cancel | { label; variant?; className? } | ReactNode | false | "Cancel" | (`type="confirm"` only) Cancel button config. Pass `false` to omit. |
action | { label; onClick?; variant?; className? } | ReactNode | — | (`type="confirm"` only) Confirm action — pass `{ variant: "destructive" }` for delete-style flows. |
media | ReactNode | — | (`type="confirm"` only) Decorative icon / media slot rendered above the title. |
initialFocus | false | RefObject<HTMLElement> | ((openType) => HTMLElement | null | void) | — | Forwarded to the underlying Base UI `Dialog.Popup`. Pass a ref to the element to focus on open, or `false` to skip auto-focus. |