shadcn.io is not affiliated with official shadcn/ui
Menubar examples · Standard
Menubar with Checkboxes for React
A View menu of checkbox rows that show or hide the toolbar, sidebar and status bar.
View menus let people show and hide parts of the interface. This menubar's View menu holds Show Toolbar, Show Sidebar and Show Status Bar as MenubarCheckboxItem rows, each with its own check. It fits editors, design tools and any app with panels to toggle.
Preview
Installation
FAQ
How do these View checkboxes stay checked?
Show Toolbar and Show Status Bar start checked and Show Sidebar starts off. The state lives in the component, so the checks are still there the next time View opens.
Each MenubarCheckboxItem takes checked and onCheckedChange, which receives a boolean.
Where do the checkboxes sit?
In one MenubarMenu: the MenubarTrigger reads View, and its MenubarContent holds a MenubarGroup with the three rows.
Can more than one of these be on?
Yes. Each row keeps its own state. Use MenubarRadioGroup when only one option may be on.
How do I toggle a row from the keyboard?
Open View with Enter, Space or Arrow Down, move to the row with the arrow keys, and press Enter or Space to toggle it.
Related
- Simple Text MenubarA menubar with one File menu of plain
- Menubar with Radio GroupsA View menu with a Layout choice where
- Application MenubarAn application menubar with File, Edit
- Dropdown with Checkboxes Dropdown MenuA View menu of checkbox rows that show or
- Default SwitchA switch in its default off state, with
- Compact MenubarA menubar with a single Options menu