Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

4466 articles

Menu component for Stripe Apps


Menu component for Stripe Apps

SDK version

To add the Menu component to your app:

A basic menu is made up of an element to trigger the menu, and a series of MenuItems.

Loading example...

<Menu trigger={<Button>Menu</Button>}>
 <MenuItem>Edit</MenuItem>
 <MenuItem>Copy</MenuItem>
 <MenuItem>Paste</MenuItem>
</Menu>
PropertyType
childrenRequired React.ReactNode One or more MenuGroup or MenuItem components.
onActionOptional ((key: React.Key) => void) | undefined Handler that is called when an item is selected.
triggerOptional React.ReactNode The trigger element to show/hide the Menu. Must be a component that supports press events, such as a Button or Link.

Items

Menus contain multiple vertically arranged items.

Loading example...

<Box
 css={{
 backgroundColor: 'surface',
 padding: 'medium',
 borderRadius: 'medium',
 }}
>
 <Menu aria-label="Menu">
 <MenuItem>Edit</MenuItem>
 <MenuItem disabled>Copy</MenuItem>
 <MenuItem>Paste</MenuItem>
 </Menu>
</Box>
PropertyType
childrenRequired React.ReactNode The contents of the component.
disabledOptional boolean | undefined Marks an item as disabled. Disabled items cannot be selected, focused, or otherwise interacted with.
idOptional string | undefined The id of the item. This will be passed into the onAction handler of Menu.
onActionOptional ((key: React.Key) => void) | undefined Handler that is called when an item is selected.

Groups

You can divide items in a menu into groups.

Loading example...

<Box
 css={{
 backgroundColor: 'surface',
 padding: 'medium',
 borderRadius: 'medium',
 }}
>
 <Menu aria-label="Menu">
 <MenuGroup title="Actions">
 <MenuItem>Duplicate</MenuItem>
 <MenuItem>Edit</MenuItem>
 <MenuItem>Cancel</MenuItem>
 </MenuGroup>
 <MenuGroup title="Connections">
 <MenuItem>View customer</MenuItem>
 <MenuItem>View subscription</MenuItem>
 </MenuGroup>
 </Menu>
</Box>
PropertyType
childrenRequired React.ReactNode One or more MenuItem components.
titleOptional React.ReactNode

Events

Use the onAction prop as a callback to handle press events on items. You can provide the onAction prop to the Menu to handle item activation across all items, or to the MenuItem directly to handle activation for individual items.

Loading example...

<Box
 css={{
 backgroundColor: 'surface',
 padding: 'medium',
 borderRadius: 'medium',
 }}
>
 <Menu
 aria-label="Menu"
 onAction={(id) => console.log(`Item ${id} was pressed.`)}
 >
 <MenuGroup title="Actions">
 <MenuItem id="duplicate">Duplicate</MenuItem>
 <MenuItem id="edit">Edit</MenuItem>
 <MenuItem id="cancel">Cancel</MenuItem>
 </MenuGroup>
 <MenuGroup title="Connections">
 <MenuItem
 id="View customer"
 onAction={() => console.log('View customer was pressed.')}
 >
 View customer
 </MenuItem>
 <MenuItem id="View subscription">View subscription</MenuItem>
 </MenuGroup>
 </Menu>
</Box>

Triggers

The menu trigger property works together with the menu to link the menu’s open state with a trigger’s pressed state.

Loading example...

<Menu trigger={<Button>Menu</Button>}>
 <MenuGroup title="Actions">
 <MenuItem>Duplicate</MenuItem>
 <MenuItem disabled>Edit</MenuItem>
 <MenuItem>Cancel</MenuItem>
 </MenuGroup>
 <MenuGroup title="Connections">
 <MenuItem>View customer</MenuItem>
 <MenuItem>View subscription</MenuItem>
 </MenuGroup>
</Menu>

See also

Last verified 2026-09-24

Is this helpful?