overlayshwcz-drop

Drop

Floating panel positioned against a trigger with Floating UI — dropdowns, dropbars, and hover/click drops with delays and stretch sizing.

Attributes

AttributeTypeDefaultDescription
openboolean · reflectsfalseReflects the open state; setting it shows or hides the drop.
dropdownbooleanfalseAdds the z-dropdown class for dropdown styling.
placementPlacement'bottom-start'Floating UI placement: top/right/bottom/left with optional -start/-end (default bottom-start).
modestring'click'Comma-separated activation modes: click (default) and/or hover.
triggerstring''Selector or id of the trigger element. Defaults to an element with data-toggle/data-open pointing at this drop, else the previous element sibling; false disables automatic binding.
manualbooleanfalseDisables automatic trigger binding; open/close only via attributes, methods, or data-toggle/data-open/data-close.
delay-shownumber0Delay in milliseconds before showing on hover (default 0).
delay-hidenumber150Delay in milliseconds before hiding when the pointer leaves (default 150), allowing travel into the drop.
stretchstring''Sizing against the trigger: empty/trigger sets the drop's min-width to the trigger width; fill stretches it to the available viewport width. Both cap max-height to the available space.
offsetnumber | undefinedundefinedDistance in pixels from the trigger; defaults to the CSS enter-slide offset.
inlinebooleanfalseKeeps the drop in its original DOM position instead of teleporting it to document.body.
unmountbooleanfalseRemoves the rendered DOM after the close transition; the next show mounts it again.
close-on-scrollbooleanfalseCloses the drop when the page scrolls.
no-esc-closebooleanfalseDisables closing with the Esc key.
no-bg-closebooleanfalseDisables closing on outside clicks.
Inherited from Hwc
AttributeTypeDefaultDescription
i18nstring''Per-instance text overrides as key: text pairs, merged over the global z-i18n script and the built-in defaults.
floatingstring''Floating UI placement options (for example offset and shiftPadding) parsed as key: value pairs.
force-prevent-rerenderbooleanfalseSkips re-rendering after the first render; an existing data-host-inner child is adopted as the rendered DOM.
templatestring''Selector or id of an external element or <template> whose inner content is cloned in place of an inline template[data-fn="template"] child.
Inherited from Base
AttributeTypeDefaultDescription
clsstring''Adds classes to named parts as key: classes pairs; a plain string targets the default part.
stlstring''Adds inline styles to named parts as key: styles pairs; a plain string targets the default part.

Custom Styling (cls / stl)

Default cls target:drop · defaultstl target:drop

KeyDefault classclsstlDescription
dropz-dropyesyesThe floating panel (default z-drop); the default cls/stl target.

CSS Variables

VariableDefaultScopeDescription
--z-drop-enter-duration120msz-drop > .z-dropDuration of the enter animation.
--z-drop-enter-timingcubic-bezier(0.16, 1, 0.3, 1)z-drop > .z-dropEasing of the enter animation.
--z-drop-icon-margin0.5rem.z-drop-parent-iconInline-start margin of the parent chevron icon.
--z-drop-icon-transition0.3s transform.z-drop-parent-iconTransition of the parent chevron rotation.
--z-drop-slide-x0z-drop > .z-dropHorizontal enter-slide offset for the current side.
--z-drop-slide-y-4pxz-drop > .z-dropVertical enter-slide offset for the current side.
--z-drop-width18rem.z-dropDefault width of the drop panel.
--z-drop-z-index1020.z-dropStacking order of the drop panel.
--z-dropbar-lg-padding2.5rem 0.z-dropbar-lgPadding of the large dropbar variant.
--z-dropdown-bgvar(--z-drop).z-dropdownDropdown background base color, mixed with transparency using --z-dropdown-bg-o.
--z-dropdown-bg-o100%.z-dropdownDropdown background opacity percentage used in the mix.
--z-dropdown-border-colorvar(--z-border).z-dropdownDropdown border base color, mixed with transparency using --z-dropdown-border-color-o.
--z-dropdown-border-color-ovar(--z-border-o).z-dropdownDropdown border opacity percentage used in the mix.
--z-dropdown-border-width1px.z-dropdownDropdown border width.
--z-dropdown-colorvar(--z-drop-f).z-dropdownDropdown text base color, mixed with transparency using --z-dropdown-color-o.
--z-dropdown-color-o100%.z-dropdownDropdown text opacity percentage used in the mix.
--z-dropdown-dropbar-bgtransparent.z-dropdown-dropbarDropbar-dropdown background base color, mixed with transparency using --z-dropdown-dropbar-bg-o.
--z-dropdown-dropbar-bg-o0%.z-dropdown-dropbarDropbar-dropdown background opacity percentage used in the mix.
--z-dropdown-dropbar-shadownone.z-dropdown-dropbarDropbar-dropdown box shadow.
--z-dropdown-dropbar-widthauto.z-dropdown-dropbarDropbar-dropdown width.
--z-dropdown-radiusvar(--z-global-radius).z-dropdownDropdown corner radius.
--z-dropdown-shadowvar(--z-global-shadow-small).z-dropdownDropdown box shadow.
--z-dropdown-widthauto.z-dropdownDropdown width.
--z-dropnav-z1020.z-dropnav-dropbarStacking order of the dropnav presentation.

Methods

SignatureDescription
containsNode(node: Node | null): booleanReturns whether a node is inside the host or the floating panel (used for outside-click detection).
destroy(removeHost?: boolean = false): Promise<void>Closes and unmounts the drop DOM.
getAnchorElement(): HTMLElement | nullReturns the element the drop is positioned against.
hide(restoreFocus?: boolean = false): Promise<void>Closes the drop.
show(trigger?: HTMLElement | null): Promise<void>Opens the drop and positions it against the trigger.
toggle(trigger?: HTMLElement | null): Promise<void>Opens the drop if closed, otherwise closes it.

Data Hooks

AttributeValuesApplies toRoleDescription
data-close—external-triggertriggerClicking the element closes the drop matched by the selector (usually #id).
data-host-inner · from Hwc—descendantconfigMarks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering.
data-open—external-triggertriggerClicking the element opens the drop matched by the selector without toggling.
data-partdropdescendantmarkerMarks the floating panel in adopted server-rendered DOM (data-part="drop").
data-reactive · from Hwc—descendantconfigOpts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates.
data-side—descendantread-onlySet by the component to the resolved placement side (top, right, bottom, left); selects the enter-animation direction.
data-toggle—external-triggertriggerClicking the element toggles the drop matched by the selector (usually #id).

Child Content

script[data-fn="config"][type="application/json"]

JSON configuration script parsed by the base class (i18n, cls, stl, floating).

AttributeRequiredTypeDescription
data-fnyesconfigMarks the script as configuration (value: config).
data-reactivenobooleanRe-parses the configuration when the script mutates.

select[data-fn="data-source"]

Hidden select parsed into grouped option data by the base class.

AttributeRequiredTypeDescription
data-fnyesdata-sourceMarks the select as the data source (value: data-source).
data-reactivenobooleanRe-parses the options when the select mutates.

optgroup · repeatable

Groups options under a label.

AttributeRequiredTypeDescription
labelyesstringGroup header text; also the default group key.
disablednobooleanDisables every option in the group.
data-keynostringOverrides the group key used in the parsed data.
data-keywordsnocomma-separated stringComma-separated keywords stored with the group's data.

option · repeatable

One option entry within the group.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated; searched alongside the label and value.

option · repeatable

One ungrouped option entry.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated.

template[data-fn="icons"]

Instance-level icon repository.

AttributeRequiredTypeDescription
data-fnyesiconsMarks the template as an icon source (value: icons).
data-reactivenobooleanRe-parses the icons when the template mutates.

* · repeatable

One icon element.

AttributeRequiredTypeDescription
data-keyyesstringIcon key referenced by $icons.

template[data-fn="template"]

Deferred content template mounted by the base class.

AttributeRequiredTypeDescription
data-fnyestemplateMarks the template for deferred mounting (value: template).
data-reactivenobooleanRe-parses the template when it mutates.

CSS Classes

ClassRoleApplies toDescription
.z-droprootz-dropRoot class of the floating panel.
.z-drop-gridelement.z-dropGrid layout for drop content columns.
.z-drop-parent-iconelement.z-dropChevron icon on a parent trigger, rotated while its drop is open.
.z-drop-stackelement.z-dropStacks grid columns vertically on small screens.
.z-dropbarelement.z-dropFull-width bar presentation anchored below the trigger.
.z-dropbar-lgelement.z-dropLarge-padding variant of the dropbar.
.z-dropdownelement.z-dropDropdown presentation: padded, bordered, rounded panel.
.z-dropdown-dropbarelement.z-dropDropdown rendered as a full-width dropbar.
.z-dropdown-navelement.z-dropNav list inside a dropdown; marks the selected item.
.z-dropnav-dropbarelement.z-dropDropnav rendered as a full-width dropbar.

Keyboard

KeysActionWhen
EscapeCloses the open drop (unless no-esc-close).—
ArrowDown ArrowUp Home EndMoves through .z-dropdown-nav links/buttons or [role="menuitem"] entries.Focus is inside the drop.

Accessibility

PartARIADescription
drop—Floating panel; no static ARIA attributes (the trigger carries the expanded state).
  • Register as an active drop so the shared toggle system can manage Esc/outside clicks and stacking above open modals.
  • Give the trigger aria-expanded/aria-controls as appropriate; nav items in a dropdown receive aria-selected styling.