Skip to main content

Dropdown Component

warning

Components is not ready yet.

The glu-dropdown component displays a dropdown menu that can be toggled using different interaction types. It supports custom trigger content, an optional arrow indicator, and backdrop dismissal. You can control its width by setting the size to either "cover" (match trigger width) or "auto" (based on content).


Basic Usage

Example 1: Simple Dropdown

Result
Loading...
Live Editor
<glu-dropdown>
  <div slot="dropdown-trigger">
    <glu-button>Open Dropdown</glu-button>
  </div>
  <div>
    Dropdown content goes here.
  </div>
</glu-dropdown>

Trigger Actions

The triggerAction prop determines how the dropdown is toggled. It supports the following options:

  • click: Toggles the dropdown on left-click.
  • hover: Opens on mouse enter and closes on mouse leave.
  • context-menu: Toggles on right-click (preventing the default context menu).
Result
Loading...
Live Editor
<glu-dropdown triggerAction="hover">
  <div slot="dropdown-trigger">
    <glu-button>Hover to Open</glu-button>
  </div>
  <div>
    Dropdown content activated by hover.
  </div>
</glu-dropdown>

Properties

PropertyAttributeDescriptionTypeDefault
hasArrowhas-arrowIf true, an arrow will be displayed that points at the trigger.booleanfalse
isBackdropDismissis-backdrop-dismissIf true, the dropdown will be dismissed when the backdrop is clicked.booleanfalse
isOpenis-openControls whether the dropdown is open.booleanfalse
showBackdropshow-backdropIf true, a backdrop will be displayed behind the dropdown.booleanfalse
sidesideDescribes which side of the trigger to position the dropdown."bottom" | "left" | "right" | "top"'bottom'
sizesizeDescribes how to calculate the dropdown width. If "cover", the width matches the trigger element. If "auto", the width is based solely on the content."auto" | "cover"'auto'
texttextOptional default trigger text. Only shown if no trigger content is provided.string'Dropdown'
triggerActiontrigger-actionDefines the type of interaction that triggers the dropdown. 'click' toggles on left-click. 'hover' opens on mouse enter and closes on mouse leave. 'context-menu' toggles on right-click (preventing the default context menu)."click" | "context-menu" | "hover"'click'

Events

EventDescriptionType
dropdownToggleEmitted when the dropdown is toggled.CustomEvent<boolean>

Slots

SlotDescription
The default slot for the dropdown content.
"dropdown-trigger"The default slot for the dropdown trigger.

Dependencies

Used by

Depends on

Graph


Built with StencilJS