Skip to content

Dialog

Modal interaction foundation composed from Root, Trigger, Overlay, Content, and Close.

Runtime ownership

useDialogRoot comes from @varo-ui/headless; H5/UI wrappers strengthen focus, portal, and motion.

Demo

Package@varo-ui/headless

Install

bash
pnpm add @varo-ui/headless @varo-ui/h5
# or
pnpm add @varo-ui/headless @varo-ui/weapp

Why this is foundational

  • Confirmation, approval, and high-risk actions need explicit entry and exit.
  • Separate Overlay and Content adapt cleanly to each runtime.

Parts

PartRole
DialogRootOpen state and context
DialogTriggerOpen entry
DialogOverlayOverlay dismiss
DialogContentModal content
DialogCloseExplicit exit

State and events

  • State:open, defaultOpen, and disabled
  • Events:update:open and openChange.

Platform notes

H5 supports Escape; Weapp uses explicit Close/overlay. Full focus trapping belongs to UI wrappers.