Skip to content

DropdownMenu

TIP

DropdownMenu is a wrap over Dropdown with the addition of features for switching options from the keyboard.

DropdownMenu is a wrap over <Dropdown/>, which is a wrap over <Popper/>.

jsx
import DropdownMenu from '@semcore/ui/dropdown';
<DropdownMenu />;

DropdownMenuProps

& {...}
NameTypeDescription
selectableboolean Set role `menuitemradio` (or `menuitemcheckbox` if `multiselect`) for Dropdown.Item
multiselectboolean Multiple select
size Size of the menu
defaultHighlightedIndexnumber | null Index of the element selected by default
highlightedIndexnumber | null Index of the selected item
onHighlightedIndexChange(highlightedIndex: number | null) => void Callback for highlightedIndex change highlightedIndex - Index of the selected item
localestring Specifies the locale for i18n support
inlineActionsboolean Flag for menu that using as actions on DropdownMenu.Item
itemsCountnumber Count of menu items (for virtual lists only)

DropdownMenu.Trigger is a wrap over <Dropdown.Trigger/> component, which is a wrap over <Popper.Trigger/>.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Trigger />;

DropdownMenu.Popper is a wrap over <Dropdown.Popper/> component, which is a wrap over <Popper.Popper/>.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Popper />;

DropdownMenu.List is a container component for the list items with the <ScrollArea/> inside it.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.List />;

DropdownMenuListProps

& & {...}
NameTypeDescription
size Size of the menu

DropdownMenu.Menu is a wrap over the <Dropdown.Popper/> + <DropdownMenu.List/> component. In fact, it is syntactic sugar when no direct access to the Popper node is needed.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Menu />;

Interactive menu items that are available for selection and switching from the keyboard.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Item />;

DropdownMenuItemProps

& {...}
NameTypeDescription
selectedboolean Enables selected state. For selectable dropdowns only.
disabledboolean Disables item
highlightedbooleanDeprecated Adds focus styles around
notInteractivebooleanDeprecated Disables hover state
size Size of the component
indexnumber Index of item (used in virtualized lists)

Content of menu item. Use it if you need Hints, Actions of nested menus.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Item.Content />;

DropdownMenuItemHintProps

& {...}
NameTypeDescription
size Size of the component

Group of interactive menu items.

jsx
import Dropdown from '@semcore/ui/dropdown';
<Dropdown.Group />;

DropdownGroupProps

& {...}
NameTypeDescription
titleReact.ReactNode Title for group of dropdown menu items
subTitlestring Subtitle for group of dropdown menu items
stickyboolean Render group title as sticky element for nested items

This noninteractive menu item is used to display tips in the list. Using as an aria-describedby for DropdownMenu.Item.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.Item.Hint />;

DropdownMenuItemHintProps

& {...}
NameTypeDescription
size Size of the component

Context

Context of the component is available inside the render-function.

DropdownMenuContext

& {...}
NameTypeDescription
highlightedIndexnumber Tracks which menu item is currently highlighted/focused for keyboard navigation
getListProps Returns props for the menu list container
getItemProps Returns props for individual menu items
getItemHintProps Returns props for item hint/description elements
getItemTitleProps Returns props for item title elements

Deprecated

WARNING

The DropdownMenu.ItemTitle is deprecated, use DropdownMenu.Group instead.

This noninteractive menu item is used to display the titles in the list. It is a wrap over the Flex component.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.ItemTitle />;

DropdownMenuItemTitleProps

& {...}
NameTypeDescription
size Size of the component

WARNING

The DropdownMenu.ItemHint is deprecated, use DropdownMenu.Item.Hint or DropdownMenu.Group with subTitle props instead.

This noninteractive menu item is used to display tips in the list. It is a wrap over the Flex component.

jsx
import DropdownMenu from '@semcore/ui/dropdown-menu';
<DropdownMenu.ItemHint />;

DropdownMenuItemHintProps

& {...}
NameTypeDescription
size Size of the component

Released under the MIT License.

Released under the MIT License.