Material Bread
v0.2.10
Home
Getting Started
React Native
Web
Electron
MacOS
Windows
NextJs
Expo
Vue Native
Style
Font
Icons
Theme
Components
Appbar
Searchbar
Appbar Bottom
Avatar
Backdrop
Badge
Banner
Bottom Navigation
Bottom Navigation Item
Button
Card
CardActions
CardContent
CardHeader
CardMedia
Checkbox
Chip
DataTable
DataTableCell
DataTableHeader
DataTablePagination
DataTableRow
Dialog
Divider
Drawer
DrawerHeader
DrawerItem
DrawerSection
DrawerBottom
Fab
Speed dial
Icon
IconButton
List
ListExpand
ListItem
ListSection
Menu
MenuItem
Paper
Progress Bar
Progress Circle
Radio Button
Ripple
Select
SheetBottom
SheetSide
Slider
Snackbar
SwipeNav
Switch
Tabs
Tab
Textfield
Searchfield
ToggleButton
ToggleButtonGroup
Tooltip
Typography
Utils
Anchor
Color
Hoverable
Shadow
Storybook
Showcase
Contributing
Library
Docs
About

Menu Item

Menu Items display individual data within a menu. - Material Docs

import { MenuItem } from 'material-bread';

Component #

MenuItem s can contain text or icons. You can create a more custom one by replacing the children.
Menu Item 1
Menu Item 2
Menu Item 3
Menu Item 4
Live Editing
class MenuPage extends React.Component {
  constructor(props) {
    super(props)
  }
  render() {
    return (    
      <Paper radius={6} style={{ width: 200 }}>
     
        <MenuItem text={'Menu Item 1'} />
        <MenuItem text={'Menu Item 2'} />
        <Divider />
        <MenuItem disabled text={'Menu Item 3'} />
        <MenuItem text={'Menu Item 4'} />
      </Paper>
    );
  }
}

Usage #

import React, { Component } from 'react';
import { View } from 'react-native';
import { Menu, MenuItem, Button } from 'material-bread';

class MenuPage extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      visible: false
    }
  }
  render() {
    return (
      <Menu
        visible={this.state.visible}
        button={
          <Button
            text={'Show menu'}
            onPress={() => {
              this.setState({ visible: !this.state.visible });
            }}
            type="contained" />
        }>
        <MenuItem text={'Menu item 1'} onPress={() => this.setState({ visible: false })} />
        <MenuItem text={'Menu item 2'} onPress={() => this.setState({ visible: false })} />
        <MenuItem text={'Menu item 3'} onPress={() => this.setState({ visible: false })} />
        <MenuItem text={'Menu item 4'} onPress={() => this.setState({ visible: false })} />
      </Menu>
    );
  }
}

Props #

Name
Description
Type
Default
disabled
Toggles disabled
bool
icon
Renders icon on the left of the text
node
keyboardCommand
Renders arbiraty node on the far right
node
onPress
Callback on MenuItem
func
style
Styles root element
object
text
Renders main text
string
textStyle
Styles menu text
object

Demos #

You can see even more examples in the Storybook environment.

Icon #

Simply add a node to the icon prop.
Preview
Share
Get Link
Preview
Download
Live Editing
class Demo extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      visible: false
    }
  }
  render() {
    return (
      <Paper radius={6} style={{ width: 200 }}>
        <MenuItem text={'Preview'} icon={<Icon name={'remove-red-eye'} />} />
        <MenuItem text={'Share'} icon={<Icon name={'person-add'} />} />
        <MenuItem text={'Get Link'} icon={<Icon name={'link'} />} />
        <Divider />
        <MenuItem text={'Preview'} icon={<Icon name={'content-copy'} />} />
        <MenuItem text={'Download'} icon={<Icon name={'file-download'} />} />
      </Paper>
    );
  }
}

Keyboard #

Simply add a node to the keyboardCommand prop.
Cut
⌘X
Copy
⌘C
Paste
⌘V
Live Editing
class Demo extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      visible: false
    }
  }
  render() {
    return (
      <Paper radius={6} style={{ width: 200 }}>
        <MenuItem
          text={'Cut'}
          icon={<Icon name={'content-cut'} />}
          keyboardCommand={
            <Text style={{ fontSize: 12, color: '#6e6e6e' }}>&#8984;X</Text>
          }
        />

        <MenuItem
          text={'Copy'}
          icon={<Icon name={'content-copy'} />}
          keyboardCommand={
            <Text style={{ fontSize: 12, color: '#6e6e6e' }}>&#8984;C</Text>
          }
        />

        <MenuItem
          text={'Paste'}
          icon={<Icon name={'content-paste'} />}
          keyboardCommand={
            <Text style={{ fontSize: 12, color: '#6e6e6e' }}>&#8984;V</Text>
          }
        />
      </Paper>
    );
  }
}