Skip to main content

Menu menu component

Effect demonstration

1. Default effect

<Menu
data={[
{
id: "1",
title: "Bright React Native",
items: [
{ id: "1-1", title: "UI Kit" },
{
id: "1-2",
title: "Kit Tricks",
items: [
{ id: "1-2-1", title: "React Native " },
{ id: "1-2-2", title: "Flutter" },
],
},
],
},
{
id: "2",
title: "Bright Angular",
items: [
{ id: "2-1", title: "Nebular" },
{ id: "2-2", title: "ngx-admin" },
{ id: "2-3", title: "UI Bakery" },
],
},
{
id: "3",
title: "Bright Design",
items: [
{ id: "3-1", title: "Eva Design System" },
{ id: "3-2", title: "Eva Icons" },
],
},
]}
/>

2. Allow expansion of multiple menu groups

<Menu
multiple
data={[
{
id: "1",
title: "Bright React Native",
items: [
{ id: "1-1", title: "UI Kit" },
{
id: "1-2",
title: "Kit Tricks",
items: [
{ id: "1-2-1", title: "React Native " },
{ id: "1-2-2", title: "Flutter" },
],
},
],
},
{
id: "2",
title: "Bright Angular",
items: [
{ id: "2-1", title: "Nebular" },
{ id: "2-2", title: "ngx-admin" },
{ id: "2-3", title: "UI Bakery" },
],
},
{
id: "3",
title: "Bright Design",
items: [
{ id: "3-1", title: "Eva Design System" },
{ id: "3-2", title: "Eva Icons" },
],
},
]}
/>

3. Selected by default

<Menu
defaultSelectedKey="1-2-1"
data={[
{
id: "1",
title: "Bright React Native",
items: [
{ id: "1-1", title: "UI Kit" },
{
id: "1-2",
title: "Kit Tricks",
items: [
{ id: "1-2-1", title: "React Native " },
{ id: "1-2-2", title: "Flutter" },
],
},
],
},
{
id: "2",
title: "Bright Angular",
items: [
{ id: "2-1", title: "Nebular" },
{ id: "2-2", title: "ngx-admin" },
{ id: "2-3", title: "UI Bakery" },
],
},
{
id: "3",
title: "Bright Design",
items: [
{ id: "3-1", title: "Eva Design System" },
{ id: "3-2", title: "Eva Icons" },
],
},
]}
/>

4. Title left icon

<Menu
data={[
{
id: "1",
title: "Bright React Native",
left: <IconPlus />,
items: [
{ id: "1-1", title: "UI Kitten" },
{
id: "1-2",
title: "Kitten Tricks",
items: [
{ id: "1-2-1", title: "React Native Paper" },
{ id: "1-2-2", title: "TD Design" },
],
},
],
},
{
id: "2",
title: "Bright Angular",
left: <IconPlus />,
items: [
{ id: "2-1", title: "Nebular" },
{ id: "2-2", title: "ngx-admin" },
{ id: "2-3", title: "UI Bakery" },
],
},
{
id: "3",
title: "Bright Design",
left: <IconPlus />,
items: [
{ id: "3-1", title: "Eva Design System" },
{ id: "3-2", title: "Eva Icons" },
],
},
]}
/>

5. MenuItem right icon

<Menu
data={[
{
id: "1",
title: "Bright React Native",
customIcon: <IconPlus />,
},
{
id: "2",
title: "Bright Angular",
customIcon: <IconPlus />,
},
{
id: "3",
title: "Bright Design",
customIcon: <IconPlus />,
},
]}
/>

API

PropertiesRequiredDescriptionTypeDefault Value
datatruemenu dataMenuItemProps[]
multiplefalseWhether to allow multiple menu groups to be expandedbooleanfalse
widthfalsewidthnumberdeviceWidth
selectedKeyfalseselected menustring
defaultSelectedKeyfalseDefault selected menustring
onSelectfalseEvent triggered when MenuItem is selected(key: string) => void
activeColorfalseMenuItem background color when selectedstring
activeTextColorfalseMenuItem text color when selectedstring
stylefalseCustom styleViewStyle
itemStylefalseMenu item styleViewStyle
activeOpacityfalseThe opacity of the menu item when clickednumber0.6
PropertiesRequiredDescriptionTypeDefault Value
idtrueunique identifierstring
titletruetitlestring
leftfalseCustomize left contentReactNode
customIconfalseCustom iconReactNode
disabledfalseWhether to disable menu itemsbooleanfalse
itemsfalseSubmenuMenuItemProps[]