Menu#
Import#
import { Menu } from 'bumbag';
Usage#
Supply a set of <Menu.Item> components as children to <Menu> to create a menu.
Grouped items#
You can group your menu by using the <Menu.Group> component.
Option groups#
The Menu component can also have selectable option items which can act as checkbox or radio items.
Accessibility#
The <Menu> component follows the WAI ARIA Menu Pattern.
Rules#
- A
Menumust consist of a set ofMenu.Item,Menu.Group,Menu.OptionGrouporMenu.OptionItemcomponents.
Patterns#
Menuhas a role ofmenu.- Pressing Enter or Space on a menu item will trigger the item.
- Pressing ↑ or ↓ will navigate the menu items.
- A
Menu.Itemhas the role ofmenuitem. - Each
Menu.Itemhas it'stabindexset to-1except either the first element if the menu is closed, or the active element if the menu is open, where it will be0. - When a
Menu.Itemis disabled,aria-disabledwill be set totrue.
References#
Props#
Menu Props#
baseId string
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Menu.Item Props#
iconAfter
string
| IconDefinition
| { viewBoxHeight: number; viewBoxWidth: number; paths?: string[]; tree?: any[]; }Icon that appears on the right side of the menu item.
iconAfterProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 787 more ...;
label?: string;
}iconBefore
string
| IconDefinition
| { viewBoxHeight: number; viewBoxWidth: number; paths?: string[]; tree?: any[]; }Icon that appears on the left side of the menu item.
iconBeforeProps
{
unstable_system?: any;
top?: string | number | {
[key: string]: string
}; right?: string | number | {
[key: string]: string
}; bottom?: string | number | {
[key: string]: string
}; left?: string | number | {
[key: string]: string
}; ... 787 more ...;
label?: string;
}Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Menu.Group Props#
title string
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Menu.Divider Props#
orientation "horizontal" | "vertical"
Separator's orientation.
Inherits Box props
use
string
| (ComponentClass<any, any> & { useProps: any; })
| (FunctionComponent<any> & { useProps: any; })className string
children
string
| number
| boolean
| {}
| ReactElement<any, string
| ((props: any) => ReactElement<any, string
| ...
| (new (props: any) => Component<any, any, any>)>)
| (new (props: any) => Component<...>)>
| ReactNodeArray
| ReactPortal
| ((props: BoxProps) => ReactNode)alignX "right" | "left" | "center"
alignY "top" | "bottom" | "center"
variant string
colorMode string
disabled boolean
overrides
{
useCSSVariables?: boolean;
altitudes?: AltitudesThemeConfig;
borders?: BordersThemeConfig;
borderRadii?: BorderRadiiThemeConfig;
... 95 more ...;
Template?: TemplateThemeConfig;
}elementRef ((instance: any) => void) | RefObject<any>
themeKey string
Theming#
Menu.styles.baseMenu.Item.styles.baseMenu.Item.Icon.styles.baseMenu.Divider.styles.baseMenu.Group.styles.baseMenu.Group.Title.styles.base