Last modified: 4/Oct/2024
Menu Option
The options of the Menu component
#Usage
import { Button, Menu } from '@kinsta/stratus'
const MyComponent = () => (
<Menu
options={[
<Menu.OptionGroup label="Group Label 1">
<Menu.Option value="option-1">Option 1</Menu.Option>
</Menu.OptionGroup>,
<Menu.OptionGroup label="Group Label 2">
<Menu.Option value="option-2">Option 2</Menu.Option>
<Menu.Option>Option 3</Menu.Option>
</Menu.OptionGroup>,
]}
>
<Button>Reference Element</Button>
</Menu>
)
#Props
#value
string
This string will be provided to
onSelect
props callback#index
number
#isInGroup
boolean
If true, the item will be rendered as a group header
#isDisabled
boolean
Disables the item
#hasSeparatorBefore
boolean
Adds a Separator element before the item
#hasSeparatorAfter
boolean
Adds a Separator element after the item
#onSelect
(value?: string) => unknown
Handler to call when the menu item is selected
#Types
MenuOptionProps
: props of theMenu.Option
componentMenuOptionOrGroupElements
: the type that includes theMenu.Option
,Menu.OptionGroup
and arrays of them.
Read more about types here