The padding required to prevent the arrow from reaching the very edge of the popper.
Menu
An accessible dropdown menu for the common dropdown menu button design pattern. Menu uses roving tabIndex for focus management.
Props#
Menu Props#
arrowPadding
arrowPadding
number
8
autoSelect
autoSelect
If true
, the first enabled menu item will receive focus and be selected
when the menu opens.
boolean
true
boundary
boundary
The boundary area for the popper. Used within the preventOverflow
modifier
HTMLElement | "clippingParents" | "scrollParent"
"clippingParents"
closeOnBlur
closeOnBlur
If true
, the menu will close when you click outside
the menu list
boolean
true
closeOnSelect
closeOnSelect
If true
, the menu will close when a menu item is
clicked
boolean
true
colorScheme
colorScheme
Color Schemes for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
computePositionOnMount
computePositionOnMount
boolean
defaultIsOpen
defaultIsOpen
boolean
direction
direction
If rtl
, poper placement positions will be flipped i.e. 'top-right' will
become 'top-left' and vice-verse
"ltr" | "rtl"
eventListeners
eventListeners
If provided, determines whether the popper will reposition itself on scroll
and resize
of the window.
boolean | { scroll?: boolean; resize?: boolean; } | undefined
true
flip
flip
If true
, the popper will change its placement and flip when it's
about to overflow its boundary area.
boolean
true
gutter
gutter
The distance or margin between the reference and popper.
It is used internally to create an offset
modifier.
NB: If you define offset
prop, it'll override the gutter.
number
8
id
id
string
isLazy
isLazy
Performance 🚀:
If true
, the MenuItem rendering will be deferred
until the menu is open.
boolean
isOpen
isOpen
boolean
lazyBehavior
lazyBehavior
Performance 🚀: The lazy behavior of menu's content when not visible. Only works when `isLazy={true}` - "unmount": The menu's content is always unmounted when not open. - "keepMounted": The menu's content initially unmounted, but stays mounted when menu is open.
LazyMode
"unmount"
matchWidth
matchWidth
If true
, the popper will match the width of the reference at all times.
It's useful for autocomplete
, `date-picker` and select
patterns.
boolean
modifiers
modifiers
Array of popper.js modifiers. Check the docs to see the list of possible modifiers you can pass. @see Docs https://popper.js.org/docs/v2/modifiers/
Partial<Modifier<string, any>>[]
offset
offset
The main and cross-axis offset to displace popper element from its reference element.
[number, number]
onClose
onClose
(() => void)
onOpen
onOpen
(() => void)
placement
placement
The placement of the popper relative to its reference.
PlacementWithLogical
"bottom"
preventOverflow
preventOverflow
If true
, will prevent the popper from being cut off and ensure
it's visible within the boundary area.
boolean
true
size
size
Sizes for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
strategy
strategy
The CSS positioning strategy to use.
"fixed" | "absolute"
"absolute"
variant
variant
Variants for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
MenuButton Props#
MenuButton
composes Box so you can pass all
Box
props to change its style.
MenuList Props#
MenuList
composes Box so you can pass all Box
props to change its style.
motionProps
motionProps
The framer-motion props to animate the menu list
HTMLMotionProps<"div">
rootProps
rootProps
Props for the root element that positions the menu.
HTMLChakraProps<"div">
MenuItem Props#
closeOnSelect
closeOnSelect
Overrides the parent menu's closeOnSelect
prop.
boolean
command
command
Right-aligned label text content, useful for displaying hotkeys.
string
commandSpacing
commandSpacing
The spacing between the command and menu item's label.
SystemProps["ml"]
icon
icon
The icon to render before the menu item's label.
React.ReactElement
iconSpacing
iconSpacing
The spacing between the icon and menu item's label.
SystemProps["mr"]
isDisabled
isDisabled
If true
, the menuitem will be disabled
boolean
isFocusable
isFocusable
If true
and the menuitem is disabled, it'll
remain keyboard-focusable
boolean
MenuGroup Props#
MenuGroup
composes Box so you can pass all
Box
props to change its style.
MenuOptionGroup Props#
defaultValue
defaultValue
string | string[]
onChange
onChange
((value: string | string[]) => void)
type
type
"checkbox" | "radio"
value
value
string | string[]
MenuItemOption Props#
MenuItemOption
composes Box so you can pass all
box props in addition to these:
closeOnSelect
closeOnSelect
Overrides the parent menu's closeOnSelect
prop.
boolean
command
command
Right-aligned label text content, useful for displaying hotkeys.
string
commandSpacing
commandSpacing
The spacing between the command and menu item's label.
SystemProps["ml"]
icon
icon
ReactElement<any, string | JSXElementConstructor<any>> | null
iconSpacing
iconSpacing
The spacing between the icon and menu item's label.
SystemProps["mr"]
isChecked
isChecked
boolean
isDisabled
isDisabled
If true
, the menuitem will be disabled
boolean
isFocusable
isFocusable
If true
and the menuitem is disabled, it'll
remain keyboard-focusable
boolean
type
type
"checkbox" | "radio"
value
value
string
Props#
Menu Props#
arrowPadding
arrowPadding
The padding required to prevent the arrow from reaching the very edge of the popper.
number
8
autoSelect
autoSelect
If true
, the first enabled menu item will receive focus and be selected
when the menu opens.
boolean
true
boundary
boundary
The boundary area for the popper. Used within the preventOverflow
modifier
HTMLElement | "clippingParents" | "scrollParent"
"clippingParents"
closeOnBlur
closeOnBlur
If true
, the menu will close when you click outside
the menu list
boolean
true
closeOnSelect
closeOnSelect
If true
, the menu will close when a menu item is
clicked
boolean
true
colorScheme
colorScheme
Color Schemes for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
computePositionOnMount
computePositionOnMount
boolean
defaultIsOpen
defaultIsOpen
boolean
direction
direction
If rtl
, poper placement positions will be flipped i.e. 'top-right' will
become 'top-left' and vice-verse
"ltr" | "rtl"
eventListeners
eventListeners
If provided, determines whether the popper will reposition itself on scroll
and resize
of the window.
boolean | { scroll?: boolean; resize?: boolean; } | undefined
true
flip
flip
If true
, the popper will change its placement and flip when it's
about to overflow its boundary area.
boolean
true
gutter
gutter
The distance or margin between the reference and popper.
It is used internally to create an offset
modifier.
NB: If you define offset
prop, it'll override the gutter.
number
8
id
id
string
isLazy
isLazy
Performance 🚀:
If true
, the MenuItem rendering will be deferred
until the menu is open.
boolean
isOpen
isOpen
boolean
lazyBehavior
lazyBehavior
Performance 🚀: The lazy behavior of menu's content when not visible. Only works when `isLazy={true}` - "unmount": The menu's content is always unmounted when not open. - "keepMounted": The menu's content initially unmounted, but stays mounted when menu is open.
LazyMode
"unmount"
matchWidth
matchWidth
If true
, the popper will match the width of the reference at all times.
It's useful for autocomplete
, `date-picker` and select
patterns.
boolean
modifiers
modifiers
Array of popper.js modifiers. Check the docs to see the list of possible modifiers you can pass. @see Docs https://popper.js.org/docs/v2/modifiers/
Partial<Modifier<string, any>>[]
offset
offset
The main and cross-axis offset to displace popper element from its reference element.
[number, number]
onClose
onClose
(() => void)
onOpen
onOpen
(() => void)
placement
placement
The placement of the popper relative to its reference.
PlacementWithLogical
"bottom"
preventOverflow
preventOverflow
If true
, will prevent the popper from being cut off and ensure
it's visible within the boundary area.
boolean
true
size
size
Sizes for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
strategy
strategy
The CSS positioning strategy to use.
"fixed" | "absolute"
"absolute"
variant
variant
Variants for Menu
are not implemented in the default theme. You can extend the theme to implement them.
string
MenuButton Props#
MenuButton
composes Box so you can pass all
Box
props to change its style.
MenuList Props#
MenuList
composes Box so you can pass all Box
props to change its style.
motionProps
motionProps
The framer-motion props to animate the menu list
HTMLMotionProps<"div">
rootProps
rootProps
Props for the root element that positions the menu.
HTMLChakraProps<"div">
MenuItem Props#
closeOnSelect
closeOnSelect
Overrides the parent menu's closeOnSelect
prop.
boolean
command
command
Right-aligned label text content, useful for displaying hotkeys.
string
commandSpacing
commandSpacing
The spacing between the command and menu item's label.
SystemProps["ml"]
icon
icon
The icon to render before the menu item's label.
React.ReactElement
iconSpacing
iconSpacing
The spacing between the icon and menu item's label.
SystemProps["mr"]
isDisabled
isDisabled
If true
, the menuitem will be disabled
boolean
isFocusable
isFocusable
If true
and the menuitem is disabled, it'll
remain keyboard-focusable
boolean
MenuGroup Props#
MenuGroup
composes Box so you can pass all
Box
props to change its style.
MenuOptionGroup Props#
defaultValue
defaultValue
string | string[]
onChange
onChange
((value: string | string[]) => void)
type
type
"checkbox" | "radio"
value
value
string | string[]
MenuItemOption Props#
MenuItemOption
composes Box so you can pass all
box props in addition to these:
closeOnSelect
closeOnSelect
Overrides the parent menu's closeOnSelect
prop.
boolean
command
command
Right-aligned label text content, useful for displaying hotkeys.
string
commandSpacing
commandSpacing
The spacing between the command and menu item's label.
SystemProps["ml"]
icon
icon
ReactElement<any, string | JSXElementConstructor<any>> | null
iconSpacing
iconSpacing
The spacing between the icon and menu item's label.
SystemProps["mr"]
isChecked
isChecked
boolean
isDisabled
isDisabled
If true
, the menuitem will be disabled
boolean
isFocusable
isFocusable
If true
and the menuitem is disabled, it'll
remain keyboard-focusable
boolean
type
type
"checkbox" | "radio"
value
value
string