React Native MantineOverlays

Menu

Dropdown menu with items

Import: import { Menu } from 'react-native-mantine';

Usage

import { Menu, Button, Text, Paper } from 'react-native-mantine';

const MyComponent = () => {
  return (
    <Menu>
      <Menu.Target>
        <Button>Open Menu</Button>
      </Menu.Target>

      <Menu.Dropdown>
        <Paper shadow="md" p={0}>
          <Menu.Item onPress={() => console.log('Item 1')}>
            <Text>Menu Item 1</Text>
          </Menu.Item>
          <Menu.Item onPress={() => console.log('Item 2')}>
            <Text>Menu Item 2</Text>
          </Menu.Item>
          <Menu.Divider />
          <Menu.Item color="red">
            <Text>Delete</Text>
          </Menu.Item>
        </Paper>
      </Menu.Dropdown>
    </Menu>
  );
};

Props

PropTypeDefaultDescription
openedbooleanControlled opened state
onChange(opened: boolean) => voidCalled when menu state changes
position'bottom' | 'top' | 'left' | 'right' | 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'Menu position
widthnumber | 'target'Menu width
closeOnItemClickbooleanClose menu on item click
closeOnClickOutsidebooleanClose menu on click outside
shadow'xs' | 'sm' | 'md' | 'lg' | 'xl'Menu shadow
radiusMantineNumberSizeBorder radius
zIndexnumberZ-index
children (required)React.ReactNodeMenu.Target and Menu.Dropdown elements
accessibilityLabelstringAccessibility label for the menu
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm