Switch to infinite scroll (Full book)

Menu

Menu aims to manage a floating menu of controls.

Menu manages both the menu proper (the dropdown) and the button that opens it. It manages the opened state.

  • The user toggles the menu by clicking the control that lives in Menu.Target.
  • In Menu.DropDown, we add a set of Menu.Item which are <button> under the hood.
  • We can separate sections with Menu.Divider. We can label section with Menu.Label.

overall structure

<Menu shadow="md">
    <Menu.Target>
        <Button>Toggle menu</Button>
    </Menu.Target>
    <Menu.Dropdown>/* */</Menu.Dropdown>
</Menu>

menu proper

<Menu.Dropdown>
    <Menu.Label>Application</Menu.Label>
    <Menu.Item leftSection={<IconSettings size={14} />}>Settings</Menu.Item>
    <Menu.Item leftSection={<IconMessageCircle size={14} />}>Messages</Menu.Item>
    <Menu.Divider />
    <Menu.Label>Danger zone</Menu.Label>
    <Menu.Item leftSection={<IconArrowsLeftRight size={14} />}>Transfer</Menu.Item>
    <Menu.Item leftSection={<IconTrash size={14} />}>Delete</Menu.Item>
</Menu.Dropdown>
earlymorning logo

Menu

Menu aims to manage a floating menu of controls.

Menu manages both the menu proper (the dropdown) and the button that opens it. It manages the opened state.

  • The user toggles the menu by clicking the control that lives in Menu.Target.
  • In Menu.DropDown, we add a set of Menu.Item which are <button> under the hood.
  • We can separate sections with Menu.Divider. We can label section with Menu.Label.

overall structure

<Menu shadow="md">
    <Menu.Target>
        <Button>Toggle menu</Button>
    </Menu.Target>
    <Menu.Dropdown>/* */</Menu.Dropdown>
</Menu>

menu proper

<Menu.Dropdown>
    <Menu.Label>Application</Menu.Label>
    <Menu.Item leftSection={<IconSettings size={14} />}>Settings</Menu.Item>
    <Menu.Item leftSection={<IconMessageCircle size={14} />}>Messages</Menu.Item>
    <Menu.Divider />
    <Menu.Label>Danger zone</Menu.Label>
    <Menu.Item leftSection={<IconArrowsLeftRight size={14} />}>Transfer</Menu.Item>
    <Menu.Item leftSection={<IconTrash size={14} />}>Delete</Menu.Item>
</Menu.Dropdown>