Dialog, Popover, DropdownMenu

Fiddle
Floating surfaces on bg-overlay with one hairline and shadow-overlay.
Open siteCopy linkDelete site

Usage

The import, then a use to start from. Both copy as they are.

Import
import { Button } from "@/components/ui/button";import {    Dialog,    DialogClose,    DialogContent,    DialogDescription,    DialogFooter,    DialogHeader,    DialogTitle,    DialogTrigger} from "@/components/ui/dialog";
Example
<Dialog>    <DialogTrigger asChild>        <Button variant="destructiveOutline">Delete site</Button>    </DialogTrigger>    <DialogContent>        <DialogHeader>            <DialogTitle>Delete docs.acme.dev?</DialogTitle>            <DialogDescription>Visitors will see a 404 until you publish again.</DialogDescription>        </DialogHeader>        <DialogFooter>            <DialogClose asChild>                <Button variant="outline">Cancel</Button>            </DialogClose>            <Button variant="destructive" onClick={deleteSite}>                Delete site            </Button>        </DialogFooter>    </DialogContent></Dialog>

When to use

Use it for

  • Dialog for a decision that blocks the page: confirming a destructive step, or a short form. DialogBody holds anything between the header and the footer.
  • Popover for a small interactive panel anchored to its trigger: a filter, a picker.
  • DropdownMenu for actions on a thing, with destructive items last.
  • All three sit on bg-overlay with one hairline and shadow-overlay; don't restyle them.

Avoid

  • A dialog for information that fits on the page, or for a long flow: give the flow a page.
  • A popover with only text in it: that's a Tooltip.

Accessibility

Checks

  • Dialogs trap focus, close on Escape and return focus to the trigger. Keep DialogTitle, even when it's visually hidden.
  • Menus move with the arrow keys and type-ahead, and every item has a text label.

API

Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.

Dialog

Its stories don't declare argTypes, so no props are listed. The variants show its states.
Also exportsDialogBodyDialogCloseDialogContentDialogDescriptionDialogFooterDialogHeaderDialogOverlayDialogPortalDialogTitleDialogTrigger
VariantsDefaultPersistentOpenByDefault

Popover

Its stories don't declare argTypes, so no props are listed. The variants show its states.
Also exportsPopoverAnchorPopoverClosePopoverContentPopoverTrigger
VariantsDefaultOpenByDefault

DropdownMenu

Its stories don't declare argTypes, so no props are listed. The variants show its states.
Also exportsDropdownMenuCheckboxItemDropdownMenuContentDropdownMenuGroupDropdownMenuItemDropdownMenuLabelDropdownMenuPortalDropdownMenuRadioGroupDropdownMenuRadioItemDropdownMenuSeparatorDropdownMenuShortcutDropdownMenuSubDropdownMenuSubContentDropdownMenuSubTriggerDropdownMenuTrigger
VariantsDefaultWithCheckboxItemsWithCheckboxIndicatorsWithRadioItemsWithSubmenuWithRadioItemsWithoutIndicator

Keep going

Patterns
How components come together into pages.
Surfaces
Introduce layering of components with ease.