Skip to main content

Menu

An action sheet listing selectable actions. It renders on top of Sheet, so it opens from the bottom and supports drag-to-dismiss. Pass isVisible/onClose and a flat actions array.

Open menu
function PostMenu() {
const [isVisible, setIsVisible] = useState(false);

return (
<>
<Button label="Open menu" onPress={() => setIsVisible(true)} />
<Menu
isVisible={isVisible}
onClose={() => setIsVisible(false)}
title="Post options"
actions={[
{ label: 'Edit', onPress: () => {} },
{ label: 'Share', onPress: () => {} },
{ label: 'Delete', onPress: () => {}, isDestructive: true },
{ label: 'Archive', onPress: () => {}, isDisabled: true },
]}
/>
</>
);
}

Props

PropTypeDefaultDescription
isVisiblebooleanRequired. Controls whether the menu sheet is shown.
onClose() => voidRequired. Called when the backdrop is pressed, the sheet is dragged down, or an action is pressed.
actionsTMenuAction[]Required. The list of actions rendered as menu items.
titlestringOptional heading rendered above the actions.
testIDstringBase test ID; propagated to each action as `${testID}-action-${index}`.

TMenuAction

PropTypeDefaultDescription
labelstringRequired. Action text.
onPress() => voidRequired. Called when the action is pressed, immediately followed by onClose.
iconReactNodeOptional leading icon.
isDestructivebooleanfalseStyles the label in the destructive (error) color.
isDisabledbooleanfalseDisables the action and dims it.