Shows a list of items in a popup next to a target element. The user selects one item from the list.
- Slots
-
target— Renders the dropdown's target element. -
default— Renders the dropdown list items. -
header— Renders content before the list items, such as a text field. The content is not part of the list and keeps its own keys. -
footer— Renders content after the list items, such as action buttons. The content is not part of the list and keeps its own keys.
- CSS Parts
-
base— The dropdown list wrapper container. -
list— The dropdown list element.
Properties
Section titled "Properties"Whether the dropdown flips to the opposite side of the target when it does not fit in the visible area. It flips back when its preferred side has enough space again.
flip: boolean keepOpenOnOutsideClick
Section titled "keepOpenOnOutsideClick"Whether the component stays open when the user clicks outside of it.
keepOpenOnOutsideClick: boolean keepOpenOnSelect
Section titled "keepOpenOnSelect"Whether the component stays open after the user selects an item.
keepOpenOnSelect: boolean placement
Section titled "placement"The preferred placement of the component around the target element.
placement: PopoverPlacement sameWidth
Section titled "sameWidth"Whether the dropdown has the same width as the target.
sameWidth: boolean scrollStrategy
Section titled "scrollStrategy"The behavior of the component when a parent container scrolls.
If the value is hide, the component hides while the anchor is fully out
of view. hide is the default value.
If the value is scroll, the component stays visible and anchored.
If the value is close, the component closes on each scroll.
scrollStrategy: PopoverScrollStrategy Accessors
Section titled "Accessors"groups
Section titled "groups"Returns the group items of the dropdown.
get groups(): IgrDropdownGroupComponent[]
Returns IgrDropdownGroupComponent[]
items
Section titled "items"Returns the items of the dropdown.
get items(): IgrDropdownItemComponent[]
Returns IgrDropdownItemComponent[]
selectedItem
Section titled "selectedItem"Returns the selected item from the dropdown or null.
get selectedItem(): IgrDropdownItemComponent | null
Returns IgrDropdownItemComponent | null
Methods
Section titled "Methods"clearSelection
Section titled "clearSelection"Clears the current selection of the dropdown.
clearSelection(): void Returns void
Closes the component. It does not emit events. The promise resolves to
false when the component is already closed, or when a later call
replaces this one.
hide(): Promise<boolean> Returns Promise<boolean>
navigateTo
Section titled "navigateTo"Navigates to the item with the specified value. If it exists, returns the found item, otherwise - null.
navigateTo(value: string): IgrDropdownItemComponent | null Parameters
- value:
string
Returns IgrDropdownItemComponent | null
select
Section titled "select"Selects the item with the specified value. If it exists, returns the found item, otherwise - null.
select(value: string): IgrDropdownItemComponent | null Parameters
- value:
string
Returns IgrDropdownItemComponent | null
Opens the dropdown. It does not emit events. The optional target is the
anchor element, or its ID. The promise resolves to false when the
dropdown is already open or has no anchor, or when a later call replaces
this one.
show(target: string | HTMLElement): Promise<boolean> Parameters
- target:
string | HTMLElement
Returns Promise<boolean>
Opens the component. It does not emit events. The promise resolves to
false when the component is already open, or when a later call replaces
this one.
show(): Promise<boolean> Returns Promise<boolean>
toggle
Section titled "toggle"Opens the dropdown when it is closed, and closes it when it is open. It
does not emit events. The optional target is the anchor element for
the open, or its ID. The promise resolves to true when the state
changes.
toggle(target: string | HTMLElement): Promise<boolean> Parameters
- target:
string | HTMLElement
Returns Promise<boolean>
toggle
Section titled "toggle"Opens the component when it is closed, and closes it when it is open. It
does not emit events. The promise resolves to true when the state
changes.
toggle(): Promise<boolean> Returns Promise<boolean>
Events
Section titled "Events"onChange
Section titled "onChange"Emitted when the user selects a different item. The detail is the item.
onChange(args: CustomEvent<IgrDropdownItemComponent>): void Parameters
- args:
CustomEvent<IgrDropdownItemComponent>
Returns void
onClosed
Section titled "onClosed"Emitted after the dropdown closes on a user action.
onClosed(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onClosing
Section titled "onClosing"Emitted before the user closes the dropdown. Cancelable.
onClosing(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onOpened
Section titled "onOpened"Emitted after the dropdown opens on a user action.
onOpened(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>
Returns void
onOpening
Section titled "onOpening"Emitted before the user opens the dropdown. Cancelable.
onOpening(args: CustomEvent<void>): void Parameters
- args:
CustomEvent<void>