packages/components/eui-dropdown/eui-dropdown.component.ts
A flexible dropdown menu component that displays contextual content in an overlay panel. Supports keyboard navigation, nested submenus, positioning strategies, and accessibility features. Composed of a trigger element that opens a panel containing menu items or custom content. Handles focus management, scroll behavior, and click-outside detection automatically.
<eui-dropdown>
<button euiButton>Open Menu</button>
<eui-dropdown-item>Action 1</eui-dropdown-item>
<eui-dropdown-item>Action 2</eui-dropdown-item>
</eui-dropdown>position to control dropdown placement (top, right, bottom, left)isExpandOnHover for submenu expansion without clickinghasClosedOnClickInside to false for multi-select scenariosisRightClickEnabled
OnInit
OnDestroy
AfterViewInit
| changeDetection | ChangeDetectionStrategy.OnPush |
| encapsulation | ViewEncapsulation.None |
| providers |
EuiDropdownService
|
| selector | eui-dropdown |
| imports |
OverlayModule
ScrollingModule
A11yModule
ObserversModule
|
| templateUrl | ./eui-dropdown.component.html |
| styleUrl | ./eui-dropdown.scss |
Properties |
|
Methods |
|
Inputs |
Outputs |
HostBindings |
Accessors |
| e2eAttr |
Type : string
|
Default value : 'eui-dropdown'
|
|
Sets the |
| euiDisabled |
Type : boolean
|
Default value : false
|
| hasClosedOnClickInside |
Type : boolean
|
Default value : true
|
|
Sets the |
| hasTabNavigation |
Type : boolean
|
Default value : false
|
|
Sets the |
| height |
Type : string
|
Default value : 'auto'
|
|
Sets the |
| isBlock |
Type : boolean
|
Default value : false
|
|
Sets the |
| isDropDownRightAligned |
Type : boolean
|
Default value : false
|
|
Sets the |
| isExpandOnHover |
Type : boolean
|
Default value : false
|
|
Sets the |
| isLabelUpdatedFromSelectedItem |
Type : boolean
|
Default value : false
|
|
Sets the |
| isRightClickEnabled |
Type : boolean
|
Default value : false
|
|
Sets the |
| position |
Type : "top" | "right" | "bottom" | "left"
|
Default value : 'bottom'
|
|
Sets the |
| subDropdownPosition |
Type : "right" | "left"
|
Default value : 'right'
|
|
Sets the |
| tabIndex |
Type : number
|
Default value : -1
|
|
Sets the |
| width |
Type : string
|
Default value : 'auto'
|
|
Sets the |
| expand |
Type : EventEmitter<boolean>
|
|
Event emitted when the menu expands. |
| isDropdownOpen |
Type : EventEmitter<boolean>
|
| class |
Type : string
|
|
Computes and returns the CSS classes for the component based on its current state. |
| Public closeDropdown | ||||||||||
closeDropdown(recursively: unknown)
|
||||||||||
|
Close a dropdown
Parameters :
Returns :
void
|
| Public createKeyboardHandlerSubscription |
createKeyboardHandlerSubscription()
|
|
Handles the keyboard navigation on the menu items upon opening the dropdown.
Returns :
void
|
| Public onClick |
onClick()
|
|
Method fired upon clicking the dropdown content.
Returns :
void
|
| Public onTriggerClicked | ||||||||
onTriggerClicked(e: Event)
|
||||||||
|
Method fired upon clicking the dropdown trigger.
Parameters :
Returns :
void
|
| Public onTriggerRightClicked | ||||||||
onTriggerRightClicked(e: Event)
|
||||||||
|
Method fired upon right clicking the dropdown trigger in case of context menu.
Parameters :
Returns :
void
|
| Public openDropdown | ||||||||||||
openDropdown(origin: HTMLElement, position?: literal type)
|
||||||||||||
|
Method fired when the dropdown is opened.
Parameters :
Returns :
void
|
| Public projectContentChanged |
projectContentChanged()
|
|
Method fired when the dropdown content is changed.
Returns :
void
|
| Public setParentDropdown | ||||||||
setParentDropdown(parentDropdown: EuiDropdownComponent)
|
||||||||
|
Sets the parent dropdown for a sub-dropdown.
Parameters :
Returns :
void
|
| euiDropdownItems |
Type : QueryList<unknown>
|
Decorators :
@ContentChildren(EuiDropdownItemComponent, {descendants: true})
|
| Public isOpened |
Type : unknown
|
Default value : signal(false)
|
| Public parentDropdown |
Type : EuiDropdownComponent
|
| templatePortalContent |
Type : TemplateRef<unknown>
|
Decorators :
@ViewChild('templatePortalContent')
|
| Public trapFocusAutoCapture |
Type : unknown
|
Default value : true
|
| triggerRef |
Type : ElementRef<HTMLElement>
|
Decorators :
@ViewChild('triggerRef')
|
| cssClasses |
getcssClasses()
|
|
Computes and returns the CSS classes for the component based on its current state.
Returns :
string
|
| isOpen |
getisOpen()
|
|
Whether the eui-dropdown is open. Example :
Returns :
boolean
|