React Native · Components
Menu
An action menu that opens when a button is pressed.
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Import
Menu
componentAn action menu that opens when a button is pressed. The same items array (item, group, "separator") as Menu on web; you can share the same array across both platforms.
- Phone: Opens as an action sheet from the bottom; closes by pulling down, tapping outside and the Android back button. Touch areas are 48 pixels.
- Tablet: Opens next to the trigger; flips if it does not fit on screen, and a long menu scrolls.
- Looks the same on iOS and Android (the platform menu is not used).
Examples
ContextMenu
componentA menu that opens on long press (the right-click menu on web). Items are given with the same items array as Menu.
- Phone: Opens as an action sheet from the bottom.
- Tablet: Opens where the finger is; flips left/up if it does not fit.
- Scrolling and normal taps are not affected: the element's own
onPressruns, and its ownonLongPressis called before the menu.
Examples
ContextMenuProps
interfaceProps of the ContextMenu component (same names as on web).
| Name | Type | Default | Description |
|---|---|---|---|
children | ReactElement | The area to long-press: a single element that takes onLongPress (Pressable, a card, a list row). Props are passed to this element; no extra wrapper is added. | |
items | readonly MenuEntry[] | Items, groups and separators; the same as Menu. | |
disabled? | boolean | false | With true a long press does not open the menu. |
longPressDelay? | number | 500 | Long press duration to open (ms). |
onOpenChange? | (open: boolean) => void | Called with the new state when it opens or closes. | |
mobileSheet? | boolean | true | Open from the bottom like an action sheet on narrow screens (phones)? With false it opens next to the trigger. |
label? | string | Screen reader name of the menu. | |
effect? | EffectProp | Effect of the items ("ripple", "glow"…). Defaults to appearance.defaults.menu.effect. See BuiltinEffect. | |
style? | ViewStyle | Style of the menu panel (e.g. { width: 224 }). | |
testID? | string | Test id (menu panel). |
MenuProps
interfaceProps of the Menu component (same names as on web).
| Name | Type | Default | Description |
|---|---|---|---|
trigger | ReactElement | Element that opens the menu, usually a Button. | |
items | readonly MenuEntry[] | Items, groups and separators. | |
side? | Placement | "auto" | Position relative to the trigger (e.g. "bottom-right"); flips to the opposite side if it does not fit. See Placement. Ignored when it opens as a bottom sheet on a phone. |
open? | boolean | Whether it is open in controlled use. | |
defaultOpen? | boolean | false | Open initially in uncontrolled use? |
onOpenChange? | (open: boolean) => void | Called with the new state when it opens or closes. | |
mobileSheet? | boolean | true | Open from the bottom like an action sheet on narrow screens (phones)? With false it opens next to the trigger. |
label? | string | Screen reader name of the menu. | |
effect? | EffectProp | Effect of the items ("ripple", "glow"…). Defaults to appearance.defaults.menu.effect. See BuiltinEffect. | |
style? | ViewStyle | Style of the menu panel (e.g. { width: 224 }). | |
testID? | string | Test id (menu panel). |
MenuSelectEvent
interfaceEvent fired when a menu item is selected; preventDefault() keeps the menu open.
| Name | Type | Description |
|---|---|---|
preventDefault | () => void | Prevents the menu from closing. |
defaultPrevented | boolean | Whether preventDefault() was called. |
nativeEvent | GestureResponderEvent["nativeEvent"] | undefined | The press event. |
MenuItem
interfaceAn action in a Menu (same fields as on web).
| Name | Type | Description |
|---|---|---|
label | ReactNode | Item text. |
icon? | IconProp | Icon at the start of the text: a name or an element. |
description? | ReactNode | Small description below the text. |
shortcut? | string | Keyboard shortcut (for item arrays shared with web). Not shown and does nothing on a touch screen. |
tone? | "neutral" | "danger" | Red when "danger" (e.g. Delete). |
disabled? | boolean | Cannot be selected. |
onSelect? | (event: MenuSelectEvent) => void | Called when selected. Call event.preventDefault() if you do not want the menu to close. |
href? | string | When given, this address opens on select (openLink: in-app paths navigate, others go to the system). |
MenuGroup
interfaceA group of items with a title.
| Name | Type | Description |
|---|---|---|
label | ReactNode | Title of the group. |
items | readonly MenuItem[] | Items in the group. |
MenuEntry
typeAn element of the Menu items array: an item, a group or a "separator" line.