Menu
Open the same action collection from a tap, a hold, an anchored panel or an action sheet.
npx @swipeui/cli add menuWhen to use it
- An overflow button (⋯) with options like Edit, Share and Delete.
- Long-press context menus on items such as photos or messages.
- Using the system's native menus on iOS and Android with one API.
- Sort and view options in a toolbar.
When not to use it
- Use Dropdown to choose a form value.
- Use Dialog when a decision needs an explanation or retry.
- Use Glass Menu for a glass-styled trigger.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add menu- Adds
components/swipeui/overlay/menu-support.ts,components/swipeui/overlay/menu.tsxand 15 shared helpers. - Installs @expo/ui, uniwind, react-native-reanimated, react-native-worklets, clsx, tailwind-merge, expo-haptics, class-variance-authority, react-native-gesture-handler, react-native-safe-area-context, @gorhom/bottom-sheet, expo-blur, react-native-svg. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { Menu } from '@/components/swipeui/overlay/menu';
<Menu
mode="anchored"
triggerLabel="Route actions"
actions={[
{ id: 'pin', label: 'Pin route', group: 'Organize' },
{ id: 'delete', label: 'Remove from saved', group: 'Manage', destructive: true },
]}
onSelect={handleAction}
/>;| Setting | Default | Behavior |
|---|---|---|
mode | system | Use anchored for a custom trigger or grouped rows, and action-sheet for a bottom action list. |
activation | tap | Choose longPress for context actions. |
actions, onSelect | Caller supplied | Give each action a stable ID. Set disabled and destructive independently. |
trigger, align, width | Label, auto, 240 | Customize the anchored trigger and panel. |
showCancel, messages.cancel | On, Cancel | Configure the optional cancel row in the action sheet. |
open, defaultOpen, onOpenChange | Closed | Control or observe the anchored panel and action sheet. System controls own their presentation on iOS. |
See Native Tabs Action for a navigation-specific presentation.
Use description for a short second line and children for nested actions. A parent action opens its group in an elevated panel. Tap the exposed parent, press Escape, or use the submenu's back button to return one level. Selecting a leaf reports its ID. Use side with align to position the anchored panel. clearBackdrop keeps outside dismissal active without a visible scrim. Place SheetProvider in the app's gesture root for the bottom-sheet presentation.
Behavior and gestures
- Open grouped actions and submenus, optionally from one of four directions.
- Use the bottom-sheet presentation for a full-width action list.
Accessibility
- System menus follow the platform focus and dismissal rules.
- Anchored menus expose menu items and return focus to their trigger.
- Triggers keep large touch targets.
Motion
- Uses the
pressandoverlaymotion roles, so it follows your app's feel. Passmotionto tune this one instance. - System menus use system motion. The anchored panel follows the overlay motion and Reduce Motion.
Performance
- Menu contents appear when the surface opens.
Notes for AI
- Choose mode for presentation and activation for tap or hold. Use the anchored presentation for custom triggers and grouped action rows.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.