Skip to content

    Browse components

    Dialog

    Modal built on the native <dialog>: blurred backdrop, spring scale-in and fade-out, Escape to close and focus returned to the trigger.

    Open

    Installation

    npx shadcn@latest add @glint-ui/dialog

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/dialog.json

    Usage

    import { Dialog } from "@/components/ui/dialog";
    
    <Dialog>
      <DialogTrigger>Edit profile</DialogTrigger>
      <DialogContent>
        <DialogHeader>
          <DialogTitle>Edit profile</DialogTitle>
          <DialogDescription>Changes are visible to your team.</DialogDescription>
        </DialogHeader>
        {/* form fields */}
        <DialogFooter>
          <DialogClose>Cancel</DialogClose>
        </DialogFooter>
      </DialogContent>
    </Dialog>

    Props

    PropTypeDefaultDescription
    defaultOpenbooleanfalseInitial open state when uncontrolled.
    openReactNode—Controlled open state.
    onOpenChangeReactNode—Called with the next open state.
    position"fixed" | "absolute""fixed"fixed = true modal via showModal(); absolute = contained in the nearest positioned parent.
    childrenReactNode—DialogTrigger and DialogContent (with DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose).
    classNamestring—Extra classes for the root element.