logoNamu Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
1.0.0
  • Components Overview
  • General
    • Button
    • FloatButtonNew
    • Icon
    • Typography
  • Layout
    • Divider
    • Grid
    • Layout
    • Space
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPickerNew
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCodeNew
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • TourNew
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • AppNew
    • ConfigProvider
When To Use
Notes for developers
Examples
Top Navigation
Inline menu
Collapsed inline menu
Open current submenu only
Vertical menu
Menu Themes
Sub-menu theme
Switch the menu type
API
Menu
ItemType
FAQ
Why will Menu's children be rendered twice?
Why Menu do not responsive collapse in Flex layout?
Design Token

Menu

  • DropdownPagination

    Resources

    Namu Design Charts
    Namu Design Pro
    Namu Design Pro Components
    Namu Design Mobile
    Namu Design Mini
    Namu Design Landing-Landing Templates
    Scaffolds-Scaffold Market
    Umi-React Application Framework
    dumi-Component doc generator
    qiankun-Micro-Frontends Framework
    ahooks-React Hooks Library
    Ant Motion-Motion Solution
    China Mirror 🇨🇳

    Community

    Awesome Namu Design
    Medium
    Twitter
    yuqueNamu Design in YuQue
    Namu Design in Zhihu
    Experience Cloud Blog
    seeconfSEE Conf-Experience Tech Conference

    Help

    GitHub
    Change Log
    FAQ
    Bug Report
    Issues
    Discussions
    StackOverflow
    SegmentFault

    Ant XTechMore Products

    yuqueYuQue-Document Collaboration Platform
    AntVAntV-Data Visualization
    EggEgg-Enterprise Node.js Framework
    kitchenKitchen-Sketch Toolkit
    xtechAnt Financial Experience Tech
    Theme Editor
    Made with ❤ by
    Ant Group and Namu Design Community

    A versatile menu for navigation.

    When To Use

    Navigation is an important part of any website, as a good navigation setup allows users to move around the site quickly and efficiently. Namu Design offers two navigation options: top and side. Top navigation provides all the categories and functions of the website. Side navigation provides the multi-level structure of the website.

    More layouts with navigation: Layout.

    Notes for developers

    • Menu is rendered as a ul element, so it only supports li and script-supporting elements as children nodes。Your customized node should be wrapped by Menu.Item.
    • Menu needs to collect its node structure, so its children should be Menu.* or encapsulated HOCs.

    Examples

    Top Navigation

    Horizontal top navigation menu.

    expand codeexpand code
    Inline menu

    Vertical menu with inline submenus.

    expand codeexpand code
    Collapsed inline menu

    Inline menu could be collapsed.

    Here is a complete demo with sider layout.

    expand codeexpand code
    Open current submenu only

    Click the menu and you will see that all the other menus gets collapsed to keep the entire menu compact.

    expand codeexpand code
    Vertical menu

    Submenus open as pop-ups.

    expand codeexpand code
    Menu Themes

    There are two built-in themes: light and dark. The default value is light.

    expand codeexpand code
    Sub-menu theme

    You can config SubMenu theme with theme prop to enable different theme color effect. This sample is dark for root and light for SubMenu.

    expand codeexpand code
    Switch the menu type

    Show the dynamic switching mode (between inline and vertical).

    expand codeexpand code

    API

    Common props ref:Common props

    Menu

    ParamDescriptionTypeDefault valueVersion
    defaultOpenKeysArray with the keys of default opened sub menusstring[]-
    defaultSelectedKeysArray with the keys of default selected menu itemsstring[]-
    expandIconcustom expand icon of submenuReactNode | (props: SubMenuProps & { isSubMenu: boolean }) => ReactNode-4.9.0
    forceSubMenuRenderRender submenu into DOM before it becomes visiblebooleanfalse
    inlineCollapsedSpecifies the collapsed status when menu is inline modeboolean-
    inlineIndentIndent (in pixels) of inline menu items on each levelnumber24
    itemsMenu item contentItemType[]-4.20.0
    modeType of menuvertical | horizontal | inlinevertical
    multipleAllows selection of multiple itemsbooleanfalse
    openKeysArray with the keys of currently opened sub-menusstring[]-
    overflowedIndicatorCustomized the ellipsis icon when menu is collapsed horizontallyReactNode<EllipsisOutlined />
    selectableAllows selecting menu itemsbooleantrue
    selectedKeysArray with the keys of currently selected menu itemsstring[]-
    styleStyle of the root nodeCSSProperties-
    subMenuCloseDelayDelay time to hide submenu when mouse leaves (in seconds)number0.1
    subMenuOpenDelayDelay time to show submenu when mouse enters, (in seconds)number0
    themeColor theme of the menulight | darklight
    triggerSubMenuActionWhich action can trigger submenu open/closehover | clickhover
    onClickCalled when a menu item is clickedfunction({ item, key, keyPath, domEvent })-
    onDeselectCalled when a menu item is deselected (multiple mode only)function({ item, key, keyPath, selectedKeys, domEvent })-
    onOpenChangeCalled when sub-menus are opened or closedfunction(openKeys: string[])-
    onSelectCalled when a menu item is selectedfunction({ item, key, keyPath, selectedKeys, domEvent })-

    More options in rc-menu

    ItemType

    type ItemType = MenuItemType | SubMenuType | MenuItemGroupType | MenuDividerType;

    MenuItemType

    ParamDescriptionTypeDefault valueVersion
    dangerDisplay the danger stylebooleanfalse
    disabledWhether menu item is disabledbooleanfalse
    iconThe icon of the menu itemReactNode-
    keyUnique ID of the menu itemstring-
    labelMenu labelReactNode-
    titleSet display title for collapsed itemstring-

    SubMenuType

    PropertyDescriptionTypeDefault valueVersion
    childrenSub-menus or sub-menu itemsItemType[]-
    disabledWhether sub-menu is disabledbooleanfalse
    iconIcon of sub menuReactNode-
    keyUnique ID of the sub-menustring-
    labelMenu labelReactNode-
    popupClassNameSub-menu class name, not working when mode="inline"string-
    popupOffsetSub-menu offset, not working when mode="inline"[number, number]-
    themeColor theme of the SubMenu (inherits from Menu by default)light | dark-
    onTitleClickCallback executed when the sub-menu title is clickedfunction({ key, domEvent })-

    MenuItemGroupType

    Define type as group to make as group:

    const groupItem = {
    type: 'group', // Must have
    label: 'My Group',
    children: [],
    };
    ParamDescriptionTypeDefault valueVersion
    childrenSub-menu itemsMenuItemType[]-
    labelThe title of the groupReactNode-

    MenuDividerType

    Divider line in between menu items, only used in vertical popup Menu or Dropdown Menu. Need define the type as divider:

    const dividerItem = {
    type: 'divider', // Must have
    };
    ParamDescriptionTypeDefault valueVersion
    dashedWhether line is dashedbooleanfalse

    FAQ

    Why will Menu's children be rendered twice?

    Menu collects structure info with twice-render to support HOC usage. Merging into one render may cause the logic to become much more complex. Contributions to help improve the collection logic are welcomed.

    Why Menu do not responsive collapse in Flex layout?

    Menu will render fully item in flex layout and then collapse it. You need tell flex not consider Menu width to enable responsive (online demo):

    <div style={{ flex }}>
    <div style={{ ... }}>Some Content</div>
    <Menu style={{ minWidth: 0, flex: "auto" }} />
    </div>

    Design Token

    Component Token

    Global Token

    • Navigation One
    • Navigation Two
    • Navigation Three - Submenu
    • Navigation Four - Link
    • Navigation One
      • Item 1
        • Option 1
        • Option 2
      • Item 2
        • Option 3
        • Option 4
    • Navigation Two
    • Navigation Three
    • Group
      • Option 13
      • Option 14
    • Option 1
    • Option 2
    • Option 3
    • Navigation One
      • Option 5
      • Option 6
      • Option 7
      • Option 8
    • Navigation Two
    • Navigation One
      • Option 1
      • Option 2
      • Option 3
      • Option 4
    • Navigation Two
    • Navigation Three
    • Navigation One
    • Navigation Two
    • Navigation Three


    • Navigation One
      • Option 1
      • Option 2
      • Option 3
      • Option 4
    • Navigation Two
    • Navigation Three


    • Navigation One
    • Option 5
    • Option 6
    Change Mode
    Change Style

    • Navigation One
    • Navigation Two
    • Navigation Two
      • Option 3
      • Option 4
      • Submenu
    • Navigation Three
    • Namu Design