Skip to main content
Version: Next

Menu

The Menu display a list of options. Their placement depends on the container location. They can be opened up or down.

Import

import { Menu } from '@tra-tech/react-native-kitra';

Usage

import { Menu, Icon } from '@tra-tech/react-native-kitra';
import { View } from 'react-native';

const MenuData = [
{ label: 'Add',left: <Icon type="ant-design" name="addfolder" size={17} color="#D7D1E9" />,right: <Icon type="ant-design" name="addfile" size={17} color="#D7D1E9" />,onPress(){console.log('pressed')}},
{ label: 'Delete', left: <Icon type="ant-design" name="delete" size={17} color="#D7D1E9" /> },
{ label: 'Update', left: <Icon type="ant-design" name="upcircleo" size={17} color="#D7D1E9" /> },
{ label: 'Skip', right: <Icon type="ant-design" name="fastforward" size={12} color="#D7D1E9" /> }];

const App = () => (
<View style={{ alignItems: 'center', justifyContent: 'center', flex: 1 }}>
<Menu
menuStyle={{ backgroundColor: '#8973CD' }}
button={() => <Icon name="plus" type="ant-design" size={30} color="#8973CD" />}
labelStyle={{ color: '#D7D1E9' }}
dividerColor="#EDEAF8"
items={MenuData}
/>
</View>
);

export default App;

Props

Prop nameTypeRequiredDescription
itemsArray<{label:string,
left?: React.ReactNode, right?:React.ReactNode, onPress ?: ()=>void}>
YesItems to be listed in the menu.
containerStyleStyleProp<ViewStyle>NoAdditional styles to apply to the menu container.
labelStyleStyleProp<TextStyle>NoAdditional styles to apply to the label text.
rowStyleStyleProp<TextStyle>NoAdditional styles to apply to the row container.
dividerColorstringNoColor of divider.
menuStyleStyleProp<ViewStyle>NoAdditional styles to apply to the menu.
button(isOpen: boolean)=> React.ReactNodeNoThis button opens the menu. It also returns whether the menu is open or closed.
closeOnPressboolean NoIndicates that it should close when an option is selected
themeUITheme NoThe theme to use for the component.
typographyUITypography NoThe typography to use for the component.