Docs menu

Dialog

A puffy modal card. In kawaii mode it drops in from above, squashes as it lands, kicks dust out of both bottom corners and throws stars off the top.

Installation

❯ npx shadcn@latest add https://yan.moe/r/dialog.json

Usage

tsx
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
tsx
<Dialog>
  <DialogTrigger>Open</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Share your last mochi?</DialogTitle>
      <DialogDescription>You can always buy another one tomorrow.</DialogDescription>
    </DialogHeader>
  </DialogContent>
</Dialog>

Use DialogFooter for actions and wrap any button in DialogClose asChild to make it close the dialog.

Accessibility

  • Built on Radix Dialog: focus is trapped inside, Escape and a backdrop click close it, and focus returns to the trigger.
  • Always include a DialogTitle; add a DialogDescription when the title alone is not enough.
  • With prefers-reduced-motion: reduce, the drop, the dust and the stars are skipped.

API

PropTypeDefault
intensity

Set on DialogContent. kawaii: drop, squash, dust and stars. subtle: fade in. off: just appear.

"kawaii" | "subtle" | "off""kawaii"
fx

Set on DialogContent. Overrides for the opening burst.

BurstOptions-
hideClose

Set on DialogContent. Hide the round close button in the corner.

booleanfalse
open / defaultOpen

Set on Dialog. Controlled and uncontrolled state.

boolean-
onOpenChange

Set on Dialog. Called when it opens or closes.

(open: boolean) => void-