Context Menu

A menu of actions for an element, opened by a touch and hold, with the element lifted over the dimmed screen.

import { ContextMenu } from "@plexui/react-native"

A menu from a button is a Menu.

Examples

Overview

Platforms

iOS 27Android
Native componentContext menu (UIContextMenuInteraction, .contextMenu)Popup menu on a long press
LookThe element lifted over a dimmed, blurred screen, the glass menu 16 from it by the third of the screen it is inMaterial's popup under the element at its end, the screen dimmed around it
AccessoryA glass capsule 7 over the element (Tapback's reactions), the menu under the elementA popup card 8dp over the element, the menu under it
tailTwo drops from the bar to the element's corner, the bar 8 over it by the side with more room (a messenger's reactions)No tail: the card 8dp over the element
Emoji panelA sheet of emoji from the screen's foot to the bar's, a grabber at its top, the menu going (WhatsApp's reactions)Material's bottom sheet to the bar's foot

API

ContextMenu

PropTypeDefaultDescription
openboolean—Holds the menu open or closed
onOpenChange(open: boolean) => void—Called as the menu opens or closes
childrenReactNode—The trigger, the content and an accessory (required)

ContextMenu.Trigger

PropTypeDefaultDescription
childrenReactElement—The element: a ListItem, a Pressable, anything with onLongPress (required). Its own onPress and onLongPress still run; the iOS preview is drawn again from its props
styleStyleProp<ViewStyle>—Style of the wrapper the element is measured in
radiusnumber—The element's own corner radius: the iOS preview keeps these corners (half the element's height at most), and Android cuts the dimming around the element at them. Unset: the kit's 30 on iOS, square on Android
shape"card" | "element""card"card lifts the element on the preview's card (a grouped surface, clipped); element lifts an element that draws its own shape as it is, with no card, no clip and no shadow

ContextMenu.Content

PropTypeDefaultDescription
childrenReactNode—The items (required)
widthnumber250 on iOSThe menu's width; on Android the popup fits its items
aria-labelstring—The menu's name, the element's
testIDstring—Test id

ContextMenu.Accessory

PropTypeDefaultDescription
childrenReactNode—Its items: ContextMenu.AccessoryItem, More last, and a ContextMenu.AccessoryEmojiPanel its More opens it into (required)
accessibilityLabelstring—The bar's name for assistive technologies (Reactions)
tailbooleanfalseOn iOS a messenger's tail: two drops from the bar to the element's corner, the bar 8 over it by the side with more room (ACCESSORY_TAIL)
testIDstring—Test id

ContextMenu.AccessoryItem

PropTypeDefaultDescription
accessibilityLabelstring—Its name: an emoji's name, as Heart (required)
childrenReactNode—An emoji, drawn at 28, or an element of your own
onPress() => void—Called on a press, before the menu closes
selectedbooleanfalseThe one already chosen: a gray circle behind it (the secondary container on Android)
morebooleanfalseThe bar's More: a smaller gray circle with icon. Beside a ContextMenu.AccessoryEmojiPanel it brings up the panel's sheet
iconReactNode—More's icon; a face with a plus by default, a plus beside an emoji panel
closesbooleantrueA press closes the menu (More that opens a panel keeps it open)
disabledbooleanfalseTakes no presses
testIDstring—Test id

ContextMenu.AccessoryEmojiPanel

PropTypeDefaultDescription
emojisEmojiPickerEmoji[]—Every emoji the panel offers, in order: symbol, name, group and keywords (required)
groupsEmojiPickerGroup[]—The groups' order, headings and icons in the bar of groups (a group with no icon: the kit's for Unicode's groups, else its first emoji). Unset, in the order their first emoji comes
recentsstring[]—The symbols of the emoji used lately, first in the grid under recentsLabel with a clock in the bar of groups; none, no such group
recentsLabelstring"Frequently Used"The recent ones' heading and name
onSelect(emoji: EmojiPickerEmoji) => void—An emoji picked; the menu closes (required)
searchPlaceholderstring"Search"The search field's hint and name
emptyLabelstring"No Emoji Found"Shown when a search finds nothing
accessibilityLabelstring"Emoji"The sheet's name for assistive technologies
testIDstring—Test id: its field, scroll, grid and bar of groups take it with -field, -scroll, -grid and -categories, each group's tab with -category-{id}. The sheet takes the accessory's with -sheet, its grabber -sheet-grabber, the dimming -sheet-dim

POPULAR_REACTIONS is the messenger's list of reactions in its order, 68 of them. EMOJI_CATEGORY_BAR holds the bar of groups' measures, ACCESSORY_PANEL the sheet's.

ContextMenu.Item, ContextMenu.Separator and ContextMenu.Label are Menu's.