Skip to main content

OverflowMenu

OverflowMenu displays a dropdown menu of actions positioned relative to an anchor element. It is commonly used for "more options" actions.

Import

import { OverflowMenu, MenuItem } from '@ui-kitten/components';

Basic Usage

import React, { useState } from 'react';
import { Layout, OverflowMenu, MenuItem, Button, Icon } from '@ui-kitten/components';

const OverflowMenuExample = () => {
const [visible, setVisible] = useState(false);
const [selectedIndex, setSelectedIndex] = useState(null);

const onItemSelect = (index) => {
setSelectedIndex(index);
setVisible(false);
};

const renderToggleButton = () => (
<Button onPress={() => setVisible(true)}>
More Options
</Button>
);

return (
<Layout style={{ flex: 1, padding: 16 }}>
<OverflowMenu
visible={visible}
anchor={renderToggleButton}
onBackdropPress={() => setVisible(false)}
selectedIndex={selectedIndex}
onSelect={onItemSelect}
>
<MenuItem
title="Edit"
accessoryLeft={(props) => <Icon {...props} name="edit" />}
/>
<MenuItem
title="Delete"
accessoryLeft={(props) => <Icon {...props} name="trash-2" />}
/>
<MenuItem
title="Share"
accessoryLeft={(props) => <Icon {...props} name="share" />}
/>
</OverflowMenu>
</Layout>
);
};

Props

OverflowMenu

PropertyTypeDefaultDescription
visiblebooleanfalseWhether the menu is visible.
anchor() => ReactElement-Render function for the anchor element the menu is positioned relative to.
onBackdropPress() => voidundefinedCalled when the area outside the menu is pressed.
selectedIndexIndexPathundefinedThe selected menu item index.
onSelect(index: IndexPath) => void-Called when a menu item is selected.
placement'top' | 'bottom' | 'left' | 'right''bottom'Position of the menu relative to the anchor.
childrenMenuItem[]-Menu item elements.
PropertyTypeDefaultDescription
titleReactText | (props) => ReactElement-Item title text or render function.
accessoryLeft(props) => ReactElementundefinedRender function for the left accessory.
accessoryRight(props) => ReactElementundefinedRender function for the right accessory.
disabledbooleanfalseWhether the item is disabled.

Storybook

Live examples coming soon via Storybook.