Options menu

An options menu contains a set of optional settings.

As the <OptionsMenu> component is now deprecated, an options menu may now be built using the new suite of menu components. This is showcased in the following demo, which uses the new select component that is built off of menu.

Options menu

Props

*required
NameTypeDefaultDescription
badgeBadgeProps | React.ReactNodeOptional badge rendered inside the toggle, after the children content
childrenReact.ReactNodeContent rendered inside the toggle
classNamestringAdditional classes added to the toggle
iconReact.ReactNodeOptional icon or image rendered inside the toggle, before the children content. It is recommended to wrap most basic icons in our icon component.
isCircle BetabooleanFlag indicating the toggle has circular styling. Can only be applied to plain toggles.
isDisabledbooleanFlag indicating the toggle is disabled
isExpandedbooleanFlag indicating the toggle has expanded styling
isFullHeightbooleanFlag indicating the toggle is full height
isFullWidthbooleanFlag indicating the toggle takes up the full width of its parent
isPlaceholderbooleanFlag indicating the toggle contains placeholder text
isSettingsbooleanFlag indicating whether the toggle is a settings toggle. This will override the icon property
ouiaIdnumber | stringValue to overwrite the randomly generated data-ouia-component-id. It will always target the toggle button.
ouiaSafebooleanSet the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false.
size'default' | 'sm'Adds styling which affects the size of the menu toggle
splitButtonItemsReact.ReactNode[]Elements to display before the toggle button. When included, renders the menu toggle as a split button.
status'success' | 'warning' | 'danger'Status styles of the menu toggle
statusIconReact.ReactNodeOverrides the status icon
variant'default' | 'plain' | 'primary' | 'plainText' | 'secondary' | 'typeahead'Variant styles of the menu toggle

Divider

*required
NameTypeDefaultDescription
classNamestringAdditional classes added to the divider
component'hr' | 'li' | 'div'DividerVariant.hrThe component type to use
inset{ default?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; sm?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; md?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; lg?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; xl?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; '2xl'?: 'insetNone' | 'insetXs' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl' | 'inset3xl'; }Insets at various breakpoints.
orientation{ default?: 'vertical' | 'horizontal'; sm?: 'vertical' | 'horizontal'; md?: 'vertical' | 'horizontal'; lg?: 'vertical' | 'horizontal'; xl?: 'vertical' | 'horizontal'; '2xl'?: 'vertical' | 'horizontal'; }Indicates how the divider will display at various breakpoints. Vertical divider must be in a flex layout.
role'separator' | 'presentation''separator'The ARIA role of the divider when the component property has a value other than "hr".

Select

See the Menu documentation for additional props that may be passed.
*required
NameTypeDefaultDescription
togglerequiredSelectToggleProps | ((toggleRef: React.RefObject<any>) => React.ReactNode)Select toggle. The toggle should either be a renderer function which forwards the given toggle ref, or a direct ReactNode that should be passed along with the toggleRef property.
activeItemIdstring | numberitemId of the currently active item. You can also specify isActive on the MenuItem.
activeMenustringID of the currently active menu for the drilldown variant
childrenReact.ReactNodeAnything that can be rendered inside of the Menu
classNamestringAdditional classes added to the Menu
containsDrilldownbooleanIndicates if menu contains a drilldown menu
containsFlyoutbooleanIndicates if menu contains a flyout menu
drilldownItemPathstring[]Indicates the path of drilled in menu itemIds
drilledInMenusstring[]Array of menus that are drilled in
focusTimeoutDelaynumberTime in ms to wait before firing the toggles' focus event. Defaults to 0
idstringID of the menu
isMenuDrilledInbooleanIndicates if a menu is drilled into
isNavFlyoutbooleanIndicating that the menu should have nav flyout styling
isOpenbooleanFlag to indicate if select is open
isPlainbooleanIndicates if the menu should be without the outer box-shadow
isRootMenubooleanInternal flag indicating if the Menu is the root of a menu tree
isScrollablebooleanIndicates if the menu should be srollable
maxMenuHeightstringMaximum height of select menu
menuHeightstringHeight of the select menu
onActionClick(event?: any, itemId?: any, actionId?: any) => voidCallback called when an MenuItems's action button is clicked. You can also specify it within a MenuItemAction.
onDrillIn( event: React.KeyboardEvent | React.MouseEvent, fromItemId: string, toItemId: string, itemId: string ) => voidCallback for drilling into a submenu
onDrillOut(event: React.KeyboardEvent | React.MouseEvent, toItemId: string, itemId: string) => voidCallback for drilling out of a submenu
onGetMenuHeight(menuId: string, height: number) => voidCallback for collecting menu heights
onOpenChange(isOpen: boolean) => voidCallback to allow the select component to change the open state of the menu. Triggered by clicking outside of the menu, or by pressing any keys specified in onOpenChangeKeys.
onOpenChangeKeysstring[]Keys that trigger onOpenChange, defaults to tab and escape. It is highly recommended to include Escape in the array, while Tab may be omitted if the menu contains non-menu items that are focusable.
onSelect(event?: React.MouseEvent<Element, MouseEvent>, value?: SelectOptionProps['value']) => voidCallback for updating when item selection changes. You can also specify onClick on the MenuItem.
onToggleKeydown(event: KeyboardEvent) => voidCallback to override the toggle keydown behavior. By default, when the toggle has focus and the menu is open, pressing the up/down arrow keys will focus a valid non-disabled menu item - the first item for the down arrow key and last item for the up arrow key.
ouiaIdnumber | stringValue to overwrite the randomly generated data-ouia-component-id.
ouiaSafebooleanSet the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false.
parentMenustringID of parent menu for drilldown menus
popperPropsPopperOptionsAdditional properties to pass to the popper
rolestringDetermines the accessible role of the menu. For a non-checkbox menu that can have one or more items selected, pass in "listbox".
selectedany | any[]Single itemId for single select menus, or array of itemIds for multi select. You can also specify isSelected on the MenuItem.
shouldFocusFirstItemOnOpen BetabooleanFlag indicating the first menu item should be focused after opening the menu.
shouldFocusToggleOnSelectbooleanFlag indicating the toggle should be focused after a selection. If this use case is too restrictive, the optional toggleRef property with a node toggle may be used to control focus.
shouldPreventScrollOnItemFocusbooleanFlag indicating if scroll on focus of the first menu item should occur.
variant'default' | 'typeahead'Select variant. For typeahead variant focus won't shift to menu items when pressing up/down arrows.
zIndexnumberz-index of the select menu

SelectList

*required
NameTypeDefaultDescription
childrenrequiredReact.ReactNodeAnything that can be rendered inside of menu list
aria-labelstringAdds an accessible name to the menu.
classNamestringAdditional classes added to the menu list
isAriaMultiselectablebooleanfalseIndicates to assistive technologies whether more than one item can be selected for a non-checkbox menu. Only applies when the menu's role is "listbox".

SelectOption

See the MenuItem section of the Menu documentation for additional props that may be passed.
*required
NameTypeDefaultDescription
childrenReact.ReactNodeAnything which can be rendered in a select option
classNamestringClasses applied to root element of select option
descriptionReact.ReactNodeDescription of the option
hasCheckboxbooleanIndicates the option has a checkbox
iconReact.ReactNodeRender option with icon
isDisabledbooleanIndicates the option is disabled
isExternalLinkbooleanRender an external link icon on focus or hover, and set the link's "target" attribute to a value of "_blank".
isFocusedbooleanIndicates the option is focused
isSelectedbooleanIndicates the option is selected
valueanyIdentifies the component in the Select onSelect callback

SelectGroup

See the MenuGroup section of the Menu documentation for additional props that may be passed.
*required
NameTypeDefaultDescription
childrenrequiredReact.ReactNodeAnything which can be rendered in a select group
classNamestringClasses applied to root element of select group
labelReact.ReactNodeLabel of the select group