Skip to content

Overlays ​

Dialog, Alert Dialog, Sheet, Drawer, Popover, Tooltip, Hover Card, the menus, Select, Combobox, Command and Toast share one overlay foundation and compose exactly like shadcn-vue: root + Trigger + Content.

Composition ​

Approximate web preview — the HarmonyOS rendering is the reference.

  • The open state can be controlled: SDialog({ open: this.open!! }), or observe onOpenChange.
  • Closing: wrap anything in SDialogClose, SPopoverClose, SSheetClose; tapping the scrim, the back gesture and Esc close too (configurable).

Semantic translation ​

On compact width + touch, Alert Dialog, Dropdown Menu, Select & co. automatically become bottom drawers — nothing to declare. Each component's adaptive param ('auto' by default) turns that off or forces it.

Toast ​

Approximate web preview — the HarmonyOS rendering is the reference.

Bottom-right on wide windows, bottom-centre on compact ones; swipe sideways to dismiss. Toast layers are content-sized, so touches outside the toasts go straight to the page.

Implementation notes ​

  • Every overlay opens and closes through openSparkOverlay(uiContext, scope) / closeSparkOverlay(scope); scopes come from SparkOverlayService.createScope().
  • A non-modal layer only intercepts touches within its own frame, so non-modal layers are content-sized and positioned by the dialog alignment.
  • Plain hint bubbles (Tooltip) use the system bindPopup, opened by long-press on touch screens.

MIT Licensed