Key pad menu
The EuiKeyPadMenu component presents EuiKeyPadMenuItems in a tiled format, with a fixed width which will accommodate three items and then wrap.
EuiKeyPadMenu is just a wrapping element for creating the list elements but you must declare each EuiKeyPadMenu component manually.
If the menu provides navigation for your application, wrap the EuiKeyPadMenu with <nav aria-label="Nav title"></nav>
.
Menu item
The EuiKeyPadMenuItem component can act both as an anchor as well as a button by specifying href
or onClick
respectively. It requires a text-based label
and children
for declaring the icon. This is the most flexible way for handling the customization of the icon itself.
When using the isSelected
prop to create a toggle button, you must supply both the true
and false
states explicitly to ensure the attribute is added for both states.
Beta item
If the item links to a module that is not GA (beta, lab, etc), you can add a betaBadgeLabel
and betaBadgeTooltipContent
to the card and it will properly create and position an EuiBetaBadge.
Supplying just a label will only show the first letter in the badge but displays the full label to the tooltip. You can also pass an iconType
to replace the letter.
Checkable
EuiKeyPadMenuItems can also be rendered as checkbox or radio form controls using the checkable
prop. Pass in "multi"
for checkboxes or "single"
for radios.
To ensure the EuiKeyPadMenu renders the semantically appropriate HTML elements, you will need to pass in the checkable
prop as true
or an object that requires a legend
. This will wrap the input group in a <fieldset>
with a <legend>
.
For single selection (radio) items, you must pass a singular name
prop to each item to ensure they are grouped properly. Also, if you would like to hide the visible <legend>
in favor of an screen-reader only solution, you can pass ariaLegend
instead of legend
.
Props
EuiKeyPadMenu
Prop | Description and type | Default value |
---|---|---|
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop checkable# | Description and type Renders the the group as a true | (DisambiguateSet<{ legend: ReactNode; legendProps?: Omit<_EuiFormLegendProps, "type">; }, { ariaLegend: string; }> & { ...; }) | (DisambiguateSet<...> & { ...; }) | Default value |
EuiKeyPadMenuItem
Prop | Description and type | Default value |
---|---|---|
Prop label# | Description and type The text to display beneath the icon ReactNode | Default value Required |
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop href# | Description and type Type: string | Default value |
Prop id# | Description and type One will be generated if not provided string | Default value |
Prop children# | Description and type Pass an EuiIcon, preferrably ReactNode | Default value |
Prop isDisabled# | Description and type Type: boolean | Default value |
Prop isSelected# | Description and type Indicate if an item is the current one. boolean | Default value |
Prop onClick# | Description and type Use MouseEventHandler<HTMLAnchorElement> | MouseEventHandler<HTMLButtonElement> | Default value |
Prop buttonRef# | Description and type Type: Ref<HTMLAnchorElement> | Ref<HTMLButtonElement> | Default value |
Prop checkable# | Description and type Beta badges are unavailable if the item is checkable "single" | "multi" | Default value |
Prop betaBadgeLabel# | Description and type Add a badge to the card to label it as "Beta" or other non-GA state string | Default value |
Prop betaBadgeIconType# | Description and type Supply an icon type if the badge should just be an icon IconType | Default value |
Prop betaBadgeTooltipContent# | Description and type Add a description to the beta badge (will appear in a tooltip) ReactNode | Default value |
Prop betaBadgeTooltipProps# | Description and type Extends the wrapping EuiToolTip props when Partial<Omit<EuiToolTipProps, "title" | "content" | "delay">> | Default value |