suiss/uim · Pattern

Action Bar

A More actions button that lists several menus in a drawer and opens the chosen menu's items in an alert sheet.

Action Bar is an open-source mobile pattern from suiss/uim: components composed into a flow for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Action Bar (open by default) on iOS in light mode

ActionBar groups several ActionBarMenus, such as File, Edit and View, behind one ghost icon Button. Pressing it opens a Drawer that lists each menu's trigger as a row with a chevron.

Choosing a row closes the drawer and opens that menu's items in an AlertSheet, with a Cancel button appended. Use it for toolbar-style command groups that need to fit on a phone screen.

Installation

$ pnpm dlx @esuiss/uim@latest add action-bar

The CLI also adds what it builds on: Alert Sheet, Button, Drawer, Icon, Text.

Manual

  1. Install the dependencies:
npx expo install cn phosphor-react-native react-native-svg
  1. Add the pieces it builds on: Alert Sheet, Button, Drawer, Icon, Text.

  2. Copy the source into components/patterns/action-bar.tsx:

uniwind/components/patterns/action-bar.tsx
import { cn } from "cn"
import { CaretRightIcon, DotsThreeIcon } from "phosphor-react-native"
import * as React from "react"
import { I18nManager, Pressable, View, type ViewProps } from "react-native"
import {
  AlertSheet,
  AlertSheetAction,
  AlertSheetCancel,
  AlertSheetContent,
  AlertSheetGroup,
  AlertSheetHeader,
  AlertSheetTitle,
} from "@/components/ui/alert-sheet"
import { Button } from "@/components/ui/button"
import { Drawer, DrawerContent, DrawerTrigger } from "@/components/ui/drawer"
import { Icon } from "@/components/ui/icon"
  1. Update the import paths to match your project.

Usage

import { ActionBar, ActionBarMenu, ActionBarTrigger, ActionBarContent, ActionBarLabel, ActionBarItem, ActionBarSeparator } from "@/components/patterns/action-bar"
<ActionBar defaultOpen>
  <FileMenu defaultOpen />
  <EditMenu />
  <ViewMenu />
</ActionBar>

Each child of ActionBar should be an ActionBarMenu containing one ActionBarTrigger and one ActionBarContent. The bar renders every child twice, once as a drawer row and once as a sheet, and pairs them by child index.

open, defaultOpen and onOpenChange on ActionBar control the drawer. ActionBarMenu takes its own open, defaultOpen and onOpenChange for its sheet. A string child of ActionBarTrigger is wrapped in Text.

Examples

Default

iOS
Action Bar on iOS in light mode

Overflow

Opens the More actions drawer on first render.

iOS
Action Bar (overflow) on iOS in light mode

With icons

Places an icon before each item in the Edit menu.

iOS
Action Bar (with icons) on iOS in light mode

Not dismissible

Sets dismissible to false, so sheets close only through an action or Cancel.

iOS
Action Bar (not dismissible) on iOS in light mode

Custom labels

Renames the More actions button and the Cancel button with moreLabel and cancelLabel.

iOS
Action Bar (custom labels) on iOS in light mode

Floating

Detaches the drawer from the screen edges with floating.

iOS
Action Bar (floating) on iOS in light mode

API Reference

ActionBar

The root that renders the More actions button, its drawer and each menu's sheet.

ExtendsViewProps
PropType
About
Controls whether the More actions drawer is open.
Type
boolean
Default
—
About
Whether the drawer starts open when uncontrolled.
Type
boolean
Default
false
About
Called when the drawer opens or closes.
Type
(open: boolean) => void
Default
—
About
When false, sheets ignore outside presses and close only through an action or Cancel. Defaults to true.
Type
boolean
Default
true
About
Insets the drawer from the screen edges.
Type
boolean
Default
—
About
Accessibility label of the More actions button and drawer. Defaults to More actions.
Type
string
Default
"More actions"
About
Text of the Cancel button in each sheet. Defaults to Cancel.
Type
string
Default
"Cancel"

ActionBarMenu

One menu; a row in the drawer and an AlertSheet for its items.

PropType
About
Controls whether this menu's sheet is open.
Type
boolean
Default
—
About
Opens this menu's sheet on first render.
Type
boolean
Default
—
About
Called when this menu's sheet opens or closes.
Type
(open: boolean) => void
Default
—
Type
React.ReactNode
Default
—

ActionBarTrigger

The drawer row that opens the menu's sheet, with a trailing chevron.

ExtendsReact.ComponentProps<typeof Pressable>
PropType
Type
React.ReactNode
Default
—

ActionBarContent

The menu's items in an AlertSheetContent, followed by a Cancel button.

ExtendsReact.ComponentProps<typeof AlertSheetContent>

ActionBarLabel

A title shown at the top of the sheet.

ExtendsReact.ComponentProps<typeof AlertSheetTitle>

ActionBarItem

An actionable entry, rendered as an AlertSheetAction.

ExtendsReact.ComponentProps<typeof AlertSheetAction>

ActionBarSeparator

Kept for API parity; renders nothing.

PropType
Type
string
Default
—

Accessibility

  • The More actions button and the drawer are labelled by moreLabel.
  • Each drawer row has the button role and exposes its disabled state.
  • The chevron flips in right-to-left layouts.

Notes

  • Rows sit on bg-surface-secondary with border-separator dividers; disabled rows use text-label-quaternary.
  • Without floating, the drawer's top corners are square.