Menu

드롭다운 Menu와 컨텍스트 Menu를 제공하는 컴포넌트입니다

Property


Disabled

Menu의 비활성화 상태를 설정합니다.

Examples


Positioning

Menu의 표시 위치를 설정합니다.

Groups

Menu 아이템을 그룹화합니다.

With Checkbox Items

Checkbox Item을 사용합니다.

With Radio Items

Radio Item을 사용합니다.

With Submenu

Submenu를 구성할 수 있습니다.

Props Table


Root of the Menu compound component, a list of actions or options that opens from a trigger. Manages the open state and, when disabled, disables the trigger and every item. Doesn't render its own HTML element.

PropDefaultType
defaultOpen?
false
boolean
onOpenChange?
-
function
open?
-
boolean
actionsRef?
-
React.RefObject<Menu.Root.Actions | null>
children?
-
ReactNodefunction
closeParentOnEsc?
false
boolean
defaultTriggerId?
-
stringnull
disabled?
false
boolean
handle?
-
MenuHandle<unknown>
highlightItemOnHover?
true
boolean
loopFocus?
true
boolean
modal?
true
boolean
onItemHighlighted?
-
function
onOpenChangeComplete?
-
function
orientation?
vertical
horizontalvertical
triggerId?
-
stringnull

Button that opens the menu when clicked. Renders a <button> element.

PropDefaultType
children?
-
ReactNode
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeDelay?
0
number
delay?
100
number
disabled?
false
boolean
handle?
-
MenuHandle<unknown>
nativeButton?
true
boolean
openOnHover?
-
boolean
payload?
-
unknown
render?
-
ReactElementfunction

Combines Menu.PortalPrimitive, Menu.PositionerPrimitive, and Menu.PopupPrimitive into a single part. Use portalElement or positionerElement to replace the portal or positioner. Renders a <div> element.

PropDefaultType
children?
-
ReactNode
className?
-
stringfunction
portalElement?
-
ReactElement<MenuPortalPrimitive.Props>
positionerElement?
-
ReactElement<MenuPositionerPrimitive.Props>
style?
-
React.CSSPropertiesfunction
finalFocus?
-
booleanReact.RefObject<HTMLElement | null>function
render?
-
ReactElementfunction

Portal container that renders the menu outside the normal DOM hierarchy. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
container?
-
HTMLElementShadowRootReact.RefObject<HTMLElement | ShadowRoot | null>null
keepMounted?
false
boolean
render?
-
ReactElementfunction

Positions the menu popup against its trigger and keeps it inside the viewport. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
align?
start
centerendstart
alignOffset?
0
numberfunction
anchor?
-
ElementVirtualElementReact.RefObject<Element | null>functionnull
arrowPadding?
5
number
collisionAvoidance?
-
CollisionAvoidance
collisionBoundary?
clipping-ancestors
Boundary
collisionPadding?
5
Padding
disableAnchorTracking?
false
boolean
positionMethod?
absolute
fixedabsolute
side?
bottom
bottomleftrighttopinline-endinline-start
sideOffset?
4
numberfunction
sticky?
false
boolean
render?
-
ReactElementfunction

The menu panel that holds the menu items. Renders a <div> element.

PropDefaultType
children?
-
ReactNode
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
finalFocus?
-
booleanReact.RefObject<HTMLElement | null>function
render?
-
ReactElementfunction

Interactive item in the menu that runs an action when selected. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeOnClick?
true
boolean
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
onClick?
-
function
render?
-
ReactElementfunction

Line that visually separates groups of menu items. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
orientation?
horizontal
horizontalvertical
render?
-
ReactElementfunction

Groups related menu items under a Menu.GroupLabel. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
children?
-
ReactNode
render?
-
ReactElementfunction

Label for a menu group, announced to assistive technologies. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
render?
-
ReactElementfunction

Root of a nested submenu inside a menu. Place Menu.SubmenuTriggerItem and Menu.SubmenuPopup inside it. Doesn't render its own HTML element.

PropDefaultType
defaultOpen?
false
boolean
onOpenChange?
-
function
open?
-
boolean
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
actionsRef?
-
React.RefObject<Menu.Root.Actions | null>
children?
-
ReactNode
closeParentOnEsc?
false
boolean
disabled?
false
boolean
highlightItemOnHover?
true
boolean
loopFocus?
true
boolean
onItemHighlighted?
-
function
onOpenChangeComplete?
-
function
orientation?
vertical
horizontalvertical
render?
-
ReactElementfunction

Menu item that opens a submenu, with a chevron icon at the end. Renders a <div> element.

PropDefaultType
className?
-
stringfunction
onClick?
-
function
style?
-
React.CSSPropertiesfunction
closeDelay?
0
number
delay?
100
number
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
openOnHover?
true
boolean
render?
-
ReactElementfunction

Combines Menu.PortalPrimitive, Menu.PositionerPrimitive, and Menu.PopupPrimitive into a single part that opens to the right of its trigger item. Use portalElement or positionerElement to replace the portal or positioner. Renders a <div> element.

PropDefaultType
children?
-
ReactNode
className?
-
stringfunction
portalElement?
-
ReactElement<MenuPortalPrimitive.Props>
positionerElement?
-
ReactElement<MenuPositionerPrimitive.Props>
style?
-
React.CSSPropertiesfunction
finalFocus?
-
booleanReact.RefObject<HTMLElement | null>function
render?
-
ReactElementfunction

The submenu panel that holds the nested menu items. Returns focus to Menu.SubmenuTriggerItem when it closes. Renders a <div> element.

PropDefaultType
children?
-
ReactNode
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
finalFocus?
-
booleanReact.RefObject<HTMLElement | null>function
render?
-
ReactElementfunction

Combines Menu.CheckboxItemPrimitive and Menu.CheckboxItemIndicatorPrimitive into a single part, with the check mark after the label. Renders a <div> element.

PropDefaultType
checked?
-
boolean
defaultChecked?
false
boolean
onCheckedChange?
-
function
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeOnClick?
false
boolean
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
onClick?
-
function
render?
-
ReactElementfunction

Menu item that toggles a setting on or off. Renders a <div> element.

PropDefaultType
checked?
-
boolean
defaultChecked?
false
boolean
onCheckedChange?
-
function
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeOnClick?
false
boolean
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
onClick?
-
function
render?
-
ReactElementfunction

Check mark shown while the checkbox item is checked. Renders a <span> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
keepMounted?
true
boolean
render?
-
ReactElementfunction

Groups radio items so that only one of them can be selected at a time. Renders a <div> element.

PropDefaultType
defaultValue?
-
any
onValueChange?
-
function
value?
-
any
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
children?
-
ReactNode
disabled?
false
boolean
render?
-
ReactElementfunction

Combines Menu.RadioItemPrimitive and Menu.RadioItemIndicatorPrimitive into a single part, with the check mark after the label. Renders a <div> element.

PropDefaultType
value
-
any
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeOnClick?
false
boolean
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
onClick?
-
function
render?
-
ReactElementfunction

Menu item that works like a radio button inside Menu.RadioGroup. Renders a <div> element.

PropDefaultType
value
-
any
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
closeOnClick?
false
boolean
disabled?
false
boolean
label?
-
string
nativeButton?
false
boolean
onClick?
-
function
render?
-
ReactElementfunction

Check mark shown while the radio item is selected. Renders a <span> element.

PropDefaultType
className?
-
stringfunction
style?
-
React.CSSPropertiesfunction
keepMounted?
false
boolean
render?
-
ReactElementfunction

On this page