Menu - 图1

Menu React Component

Menu component not so often seen in mobile apps. But it is proven to be extremely helpful when you need controls on top of the map, images, some text/code editor, etc.

Menu React component represents Menu component.

Menu Components

There are following components included:

  • **Menu** / **F7Menu**
  • **MenuItem** / **F7MenuItem**
  • **MenuDropdown** / **F7MenuDropdown**
  • **MenuDropdownItem** / **F7MenuDropdownItem**

Menu Properties

PropTypeDefaultDescription
<MenuItem> properties
textstringMenu item text
iconOnlybooleanEnable if menu item contains only icon
dropdownbooleanEnable if menu item contains menu dropdown
linkbooleanEnable if to render menu item as link (<a>) element if you don’t need to specific href
<MenuItem> icon related properties
iconSizestring
number
Icon size in px
iconColorstringIcon color. One of the default colors
iconstringCustom icon class
iconF7stringName of F7 Icons font icon
iconMaterialstringName of Material Icons font icon
iconFastringName of Font Awesome font icon
iconIonstringName of Ionicons font icon
iconIosstringIcon to be used in case of iOS theme is used. Consists of icon family and icon name divided by colon, e.g. f7:home or ion:home
iconMdstringIcon to be used in case of MD theme is used. Consists of icon family and icon name divided by colon, e.g. material:home or fa:home
iconAurorastringIcon to be used in case of Aurora theme is used. Consists of icon family and icon name divided by colon, e.g. f7:home or fa:home
<MenuItem> navigation/router related properties
hrefstring
boolean
#URL of the page to load. In case of boolean href=”false” it won’t add href tag
targetstringValue of link target attribute, e.g. _blank, _self, etc.
viewstringCSS selector of the View to load the page
externalbooleanEnable to bypass Framework7’s link click handler
backbooleanEnables back navigation link
forcebooleanForce page to load and ignore previous page in history (use together with back prop)
reloadCurrentbooleanReloads new page instead of the currently active one
reloadPreviousbooleanReplace the previous page in history with the new one from route
reloadAllbooleanLoad new page and remove all previous pages from history and DOM
reloadDetailbooleanReload Detail page in Master Detail view
animatebooleanDisables pages animation
ignoreCachebooleanIgnores caching
routeTabIdstringRoutable Tab id
routePropsobjectObject with additional props that will be passed to target route component
preventRouterbooleanfalseIf set, then it won’t be processed by Framework7 router
<MenuItem> action related properties
panelOpenstring
boolean
Defines panel to open. Can be left or right
panelClosebooleanCloses panel on click
panelTogglebooleanToggle (open/close) panel on click
actionsOpenstring
boolean
CSS selector of the action sheet to open on click
actionsClosestring
boolean
CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet
popupOpenstring
boolean
CSS selector of the popup to open on click
popupClosestring
boolean
CSS selector of the popup to close on click. Or boolean property to close currently opened popup
popoverOpenstring
boolean
CSS selector of the popover to open on click
popoverClosestring
boolean
CSS selector of the popover to close on click. Or boolean property to close currently opened popover
sheetOpenstring
boolean
CSS selector of the sheet modal to open on click
sheetClosestring
boolean
CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal
loginScreenOpenstring
boolean
CSS selector of the login screen to open on click
loginScreenClosestring
boolean
CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen
sortableEnablestring
boolean
CSS selector of the Sortable list to open on click
sortableDisablestring
boolean
CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list
sortableTogglestring
boolean
CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list
searchbarEnablestring
boolean
CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar
searchbarDisablestring
boolean
CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar
searchbarTogglestring
boolean
CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar
searchbarClearstring
boolean
CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar
cardOpenstring
boolean
CSS selector of the expandable card to open on click. Or boolean to open first found expandable card
cardClosestring
boolean
CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card
cardPreventOpenbooleanClick on element with this prop won’t open its parent expandable card
menuClosebooleanCloses Menu dropdown on click
<MenuDropdown> properties
contentHeightstringCSS value of dropdown height property. Specify only to limit dropdown height if there are a lot of items
positionstringDropdown position, can be left, center or right
leftbooleanSame as left
centerbooleanSame as center
rightbooleanSame as right
<MenuDropdownItem> properties
textstringMenu dropdown item text
dividerbooleanRender this item as divider (text will ignored in this case)
linkbooleanEnable if to render menu item as link (<a>) element if you don’t need to specific href
<MenuDropdownItem> navigation/router related properties
hrefstring
boolean
#URL of the page to load. In case of boolean href=”false” it won’t add href tag
targetstringValue of link target attribute, e.g. _blank, _self, etc.
viewstringCSS selector of the View to load the page
externalbooleanEnable to bypass Framework7’s link click handler
backbooleanEnables back navigation link
forcebooleanForce page to load and ignore previous page in history (use together with back prop)
reloadCurrentbooleanReloads new page instead of the currently active one
reloadPreviousbooleanReplace the previous page in history with the new one from route
reloadAllbooleanLoad new page and remove all previous pages from history and DOM
reloadDetailbooleanReload Detail page in Master Detail view
animatebooleanDisables pages animation
ignoreCachebooleanIgnores caching
routeTabIdstringRoutable Tab id
routePropsobjectObject with additional props that will be passed to target route component
preventRouterbooleanfalseIf set, then it won’t be processed by Framework7 router
<MenuDropdownItem> action related properties
panelOpenstring
boolean
Defines panel to open. Can be left or right
panelClosebooleanCloses panel on click
panelTogglebooleanToggle (open/close) panel on click
actionsOpenstring
boolean
CSS selector of the action sheet to open on click
actionsClosestring
boolean
CSS selector of the action sheet to close on click. Or boolean property to close currently opened action sheet
popupOpenstring
boolean
CSS selector of the popup to open on click
popupClosestring
boolean
CSS selector of the popup to close on click. Or boolean property to close currently opened popup
popoverOpenstring
boolean
CSS selector of the popover to open on click
popoverClosestring
boolean
CSS selector of the popover to close on click. Or boolean property to close currently opened popover
sheetOpenstring
boolean
CSS selector of the sheet modal to open on click
sheetClosestring
boolean
CSS selector of the sheet modal to close on click. Or boolean property to close currently opened sheet modal
loginScreenOpenstring
boolean
CSS selector of the login screen to open on click
loginScreenClosestring
boolean
CSS selector of the login screen to close on click. Or boolean property to close currently opened login screen
sortableEnablestring
boolean
CSS selector of the Sortable list to open on click
sortableDisablestring
boolean
CSS selector of the Sortable list to close on click. Or boolean property to close currently opened Sortable list
sortableTogglestring
boolean
CSS selector of the Sortable list to toggle on click. Or boolean property to toggle currently opened/closed Sortable list
searchbarEnablestring
boolean
CSS selector of the Expandable Searchbar to be enabled on click. Or boolean property to enable the first found Searchbar
searchbarDisablestring
boolean
CSS selector of the Expandable Searchbar to be disabled on click. Or boolean property to disable the first found Searchbar
searchbarTogglestring
boolean
CSS selector of the Expandable Searchbar to toggle on click. Or boolean property to toggle the first found Searchbar
searchbarClearstring
boolean
CSS selector of the Expandable Searchbar to clear on click. Or boolean property to clear the first found Searchbar
cardOpenstring
boolean
CSS selector of the expandable card to open on click. Or boolean to open first found expandable card
cardClosestring
boolean
CSS selector of the expandable card to close on click. Or boolean property to close currently opened expandable card
cardPreventOpenbooleanClick on element with this prop won’t open its parent expandable card
menuClosebooleanCloses Menu dropdown on click

Menu Events

EventDescription
<MenuItem> events
clickEvent will be triggered on menu item click
menuOpenedEvent will be triggered right after menu dropdown will be opened
menuClosedEvent will be triggered right after menu dropdown will be closed
<MenuDropdownItem> events
clickEvent will be triggered on menu dropdown item click

Examples

Plain Links

  1. <Menu>
  2. <MenuItem href="#" text="Item 1" />
  3. <MenuItem href="#" text="Item 2" />
  4. <MenuItem href="#" iconF7="edit" />
  5. <MenuItem href="#" iconF7="share" />
  6. </Menu>

Dropdowns

  1. <Menu>
  2. <MenuItem text="Left" dropdown>
  3. <MenuDropdown left>
  4. <MenuDropdownItem href="#" text="Menu Item 1" />
  5. <MenuDropdownItem href="#" text="Menu Item 2" />
  6. <MenuDropdownItem href="#" text="Menu Item 3" />
  7. <MenuDropdownItem href="#" text="Menu Item 4" />
  8. <MenuDropdownItem divider />
  9. <MenuDropdownItem href="#" text="Menu Item 5" />
  10. <MenuDropdownItem href="#" text="Menu Item 6" />
  11. </MenuDropdown>
  12. </MenuItem>
  13. <MenuItem text="Center" dropdown>
  14. <MenuDropdown center contentHeight="200px">
  15. <MenuDropdownItem href="#" text="Menu Item 1" />
  16. <MenuDropdownItem href="#" text="Menu Item 2" />
  17. <MenuDropdownItem href="#" text="Menu Item 3" />
  18. <MenuDropdownItem href="#" text="Menu Item 4" />
  19. <MenuDropdownItem divider />
  20. <MenuDropdownItem href="#" text="Menu Item 5" />
  21. <MenuDropdownItem href="#" text="Menu Item 6" />
  22. <MenuDropdownItem href="#" text="Menu Item 7" />
  23. <MenuDropdownItem divider />
  24. <MenuDropdownItem href="#" text="Menu Item 8" />
  25. <MenuDropdownItem href="#" text="Menu Item 9" />
  26. <MenuDropdownItem href="#" text="Menu Item 10" />
  27. </MenuDropdown>
  28. </MenuItem>
  29. <MenuItem text="Right" dropdown>
  30. <MenuDropdown right>
  31. <MenuDropdownItem href="#" text="Menu Item 1" />
  32. <MenuDropdownItem href="#" text="Menu Item 2" />
  33. <MenuDropdownItem href="#" text="Menu Item 3" />
  34. <MenuDropdownItem href="#" text="Menu Item 4" />
  35. <MenuDropdownItem divider />
  36. <MenuDropdownItem href="#" text="Menu Item 5" />
  37. <MenuDropdownItem href="#" text="Menu Item 6" />
  38. </MenuDropdown>
  39. </MenuItem>
  40. <MenuItem style={{marginLeft: 'auto'}} iconF7="share" dropdown>
  41. <MenuDropdown right>
  42. <MenuDropdownItem href="#">
  43. <span>Share on Facebook</span>
  44. <Icon className="margin-left" f7="logo_facebook" />
  45. </MenuDropdownItem>
  46. <MenuDropdownItem href="#">
  47. <span>Share on Twitter</span>
  48. <Icon className="margin-left" f7="logo_twitter" />
  49. </MenuDropdownItem>
  50. </MenuDropdown>
  51. </MenuItem>
  52. <MenuItem href="#" iconF7="edit" />
  53. </Menu>