Dropdown

A layered menu surface for grouped actions and navigation. Uses Floating UI positioning, supports nested submenus, and accepts custom trigger content via slot.

Properties

NameTypeDefaultDescription
theme'light' | 'dark''dark'Per-component theme override.
openbooleanfalseControls whether the dropdown panel is visible. Mutable and can be controlled externally.
disabledbooleanfalseDisables trigger interaction.
submenubooleanfalseNested submenu mode. Uses side placement and submenu keyboard behavior.
placementFloating placement string'bottom-start'Preferred dropdown placement relative to trigger.
strategy'fixed' | 'absolute''fixed'Floating positioning strategy.
offsetPxnumber6Gap in pixels between trigger and panel.
matchTriggerWidthbooleanfalseWhen true, panel min-width matches trigger width.
closeOnSelectbooleantrueClose panel after selecting an item.
triggerLabelstring'Options'Fallback trigger text when no trigger slot is supplied.
triggerVariant'primary' | 'secondary' | 'ghost' | 'danger''secondary'Fallback trigger button variant.
triggerSize'xs' | 'sm' | 'md' | 'lg''sm'Fallback trigger button size.
triggerIconstring'none'Fallback trigger icon name.
hideTriggerLabelbooleanfalseHides fallback trigger label visually (icon-only trigger).

Events

NameDetail typeBubblesDescription
toggle{ open: boolean }YesEmitted when menu visibility changes.
select{ value?: string; label?: string }YesEmitted when a menu item is selected.

Methods

NameSignatureDescription
show() => Promise<void>Programmatically opens the dropdown (no-op when disabled).
hide() => Promise<void>Programmatically closes the dropdown.
toggleOpen() => Promise<void>Toggles open state.

Slots

NameDescription
triggerOptional custom trigger element. Overrides built-in diwa-button trigger.
(default)Dropdown panel content. Supply menuitem buttons/links and optional nested diwa-dropdown nodes.

CSS custom properties

PropertyFallbackDescription
--diwa-bg-elevatedTokenPanel background colour.
--diwa-borderTokenPanel border colour.
--diwa-radius-mdTokenPanel corner radius.
--diwa-shadow-lgTokenPanel shadow/elevation.
--diwa-text-primaryTokenMenu item text colour.
--diwa-bg-hoverTokenMenu item hover background.