suiss/ui ยท Pattern
Action Bar
A row of menus that renders as a menubar on desktop and a single More actions sheet on mobile.
Action Bar is an open-source pattern from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
ActionBar groups several ActionBarMenus. On desktop it renders a Menubar, and hovering another trigger while a menu is open switches menus. Below the 48rem breakpoint (useIsMobile), the bar collapses into a ghost icon Button that opens a Drawer with a row per menu; choosing a row opens that menu's items in an AlertSheet.
Use it for toolbar-style command groups, such as File, Edit and View, that need to fit on small screens.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
-
Add the pieces it builds on: Alert Sheet, Button, Drawer, Menubar,
use-mobile. -
Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Examples
With icons
Places an icon before each item in the Edit menu. Set variant="destructive" on an item, here Delete, to style it as a destructive action.
By default
Set defaultOpen on the bar and on the File menu to open it on first render. On desktop only the menu's defaultOpen applies.
Not dismissible
Set dismissible to false so mobile sheets use an alert dialog that closes only through an action or Cancel, not on an outside press.
Custom labels
Use moreLabel to rename the mobile More actions button and its drawer title, and cancelLabel to rename the Cancel button of each sheet.
Floating
Set floating to inset the mobile More actions drawer from the screen edges with fully rounded corners.
Accessibility
- On desktop the bar has the
menubarrole and each trigger and item has themenuitemrole. - Disabled items expose
aria-disabled="true". Escapecloses an open menu and returns focus to its trigger.- On mobile the More actions button is labelled by
moreLabel, and each drawer row hasaria-haspopup="dialog".
API Reference
ActionBar
The root that renders a Menubar on desktop and a More actions button with a Drawer on mobile.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | - |
dismissible | boolean | true |
floating | boolean | - |
moreLabel | string | "More actions" |
cancelLabel | string | "Cancel" |
Also accepts the props of React.ComponentProps<"div">.
Each child should be an ActionBarMenu; the bar uses the child index to pair the mobile row with its sheet. open, defaultOpen and onOpenChange control the mobile More actions drawer only and have no effect on desktop.
ActionBarMenu
One menu in the bar; a MenubarMenu on desktop and an AlertSheet on mobile.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | - |
onOpenChange | (open: boolean) => void | - |
children | React.ReactNode | - |
Put one ActionBarTrigger and one ActionBarContent in each menu. Its own open, defaultOpen and onOpenChange control that menu, on desktop and for the mobile sheet.
ActionBarTrigger
The menu's button; a menubar trigger on desktop and a drawer row with a chevron on mobile.
Also accepts the props of React.ButtonHTMLAttributes<HTMLButtonElement>.
ActionBarContent
The menu's items; a MenubarContent popup on desktop and an AlertSheetContent with a Cancel button on mobile.
Also accepts align, alignOffset, side and sideOffset from MenubarContent, which position the desktop popup, and the props of React.HTMLAttributes<HTMLElement>.
Also accepts align, alignOffset, side and sideOffset from MenubarContent, which position the desktop popup, and className, children, id and aria-label.
ActionBarLabel
A non-interactive heading; a menu label on desktop and the sheet title on mobile.
Also accepts the props of React.HTMLAttributes<HTMLElement>.
Also accepts className, children and id.
ActionBarItem
An actionable entry; a MenubarItem on desktop and an AlertSheetAction on mobile.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "destructive" | - |
disabled | boolean | - |
Also accepts the props of React.HTMLAttributes<HTMLElement>.
Respond to the item with onAction. Also accepts className, children, id and aria-label.
ActionBarSeparator
A divider between item groups, rendered on desktop only.
Also accepts the props of React.HTMLAttributes<HTMLElement>.
Also accepts className.
ActionBarShortcut
A keyboard shortcut hint aligned to the end of an item, rendered on desktop only.
Also accepts the props of React.ComponentProps<typeof MenubarShortcut>.
Set mod to prefix the platform modifier key. ActionBarSeparator and ActionBarShortcut render nothing on mobile. Each part sets a data-slot, such as action-bar-trigger or action-bar-more, for styling.
Web preview
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 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.
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.
Installation
The CLI also adds what it builds on: Alert Sheet, Button, Drawer, Icon, Text.
- Install the following dependencies:
-
Add the pieces it builds on: Alert Sheet, Button, Drawer, Icon, Text.
-
Copy and paste the following code into
components/patterns/action-bar.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Alert Sheet, Button, Drawer, Icon, Text.
-
Copy and paste the following code into
components/patterns/action-bar.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Alert Sheet, Button, Drawer, Icon, Text.
-
Copy and paste the following code into
components/patterns/action-bar.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Default
Web preview
Overflow
Opens the More actions drawer on first render.

With icons
Places an icon before each item in the Edit menu.
Web preview
Not dismissible
Set dismissible to false so sheets ignore outside presses and close only through an action or Cancel.
Web preview
Custom labels
Use moreLabel to rename the More actions button and cancelLabel to rename the Cancel button of each sheet.
Web preview
Floating
Set floating to inset the drawer from the screen edges. Without it, the drawer's top corners are square.
Web preview
The React Native tab shows 1 more example.
Accessibility
- The More actions button and the drawer are labelled by
moreLabel. - Each drawer row has the
buttonrole and exposes its disabled state. - The chevron flips in right-to-left layouts.
API Reference
ActionBar
The root that renders the More actions button, its drawer and each menu's sheet.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | - |
dismissible | boolean | true |
floating | boolean | - |
moreLabel | string | "More actions" |
cancelLabel | string | "Cancel" |
Also accepts the props of ViewProps.
Each child 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 control the drawer.
ActionBarMenu
One menu; a row in the drawer and an AlertSheet for its items.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | - |
onOpenChange | (open: boolean) => void | - |
children | React.ReactNode | - |
Its own open, defaultOpen and onOpenChange control the menu's sheet.
ActionBarTrigger
The drawer row that opens the menu's sheet, with a trailing chevron.
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof Pressable>.
A string child is wrapped in Text.
ActionBarContent
The menu's items in an AlertSheetContent, followed by a Cancel button.
Also accepts the props of React.ComponentProps<typeof AlertSheetContent>.
ActionBarLabel
A title shown at the top of the sheet.
Also accepts the props of React.ComponentProps<typeof AlertSheetTitle>.
ActionBarItem
An actionable entry, rendered as an AlertSheetAction.
Also accepts the props of React.ComponentProps<typeof AlertSheetAction>.
ActionBarSeparator
Kept for API parity; renders nothing.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ActionBar
The root that renders the More actions button, its drawer and each menu's sheet.
| Parameter | Type | Default |
|---|---|---|
isPresented | Binding<Bool>? | nil |
dismissible | Bool | true |
moreLabel | LocalizedStringKey | "More actions" |
cancelLabel | LocalizedStringKey | "Cancel" |
content | () -> Content | - |
ActionBarMenu
One menu; a row in the drawer and an AlertSheet for its items.
| Parameter | Type | Default |
|---|---|---|
isPresented | Binding<Bool>? | nil |
content | () -> Content | - |
label | () -> Label | - |
_ย title | LocalizedStringKey | - |
Overloads: init(isPresented:content:label:), init(_:isPresented:content:).
ActionBarScope.ActionBarMenu
| Parameter | Type | Default |
|---|---|---|
open | Boolean? | null |
onOpenChange | (Boolean) -> Unit | {} |
defaultOpen | Boolean | false |
content | ActionBarMenuScope.() -> Unit | - |
ActionBarMenuScope.ActionBarTrigger
| Parameter | Type | Default |
|---|---|---|
text | String | - |
enabled | Boolean | true |
ActionBarMenuScope.ActionBarContent
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
ActionBar
The root that renders the More actions button, its drawer and each menu's sheet.
| Parameter | Type | Default |
|---|---|---|
open | Boolean | - |
onOpenChange | (Boolean) -> Unit | - |
modifier | Modifier | Modifier |
dismissible | Boolean | true |
floating | Boolean | false |
moreLabel | String | "More actions" |
cancelLabel | String | "Cancel" |
content | ActionBarScope.() -> Unit | - |
ActionBarLabel
A title shown at the top of the sheet.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
ActionBarItem
An actionable entry, rendered as an AlertSheetAction.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
onClick | () -> Unit | - |
modifier | Modifier | Modifier |
variant | MenuItemVariant | MenuItemVariant.Default |
enabled | Boolean | true |
icon | ImageVector? | null |
ActionBarSeparator
Kept for API parity; renders nothing.
Takes no parameters.
