shadcn.io is not affiliated with official shadcn/ui
Sidebar Layout Settings Block for React
A navigation editor in a window beside the app it edits: a layout chosen from three cards with drawn thumbnails, a collapse mode, five items with visibility toggles and Move up and down, Settings that cannot be hidden, and a drawn app that redraws on every change.
Installation
Overview
Let people arrange the navigation of their workspace and watch the app answer, with this sidebar layout editor for React with Base UI. It's an app window with a top bar that holds one action, a Shine Button that resets everything. At the start sits the editor: a Layout group of three cards, each a native radio with a drawn thumbnail (the sidebar at the start, at the end, or a top bar), a Segment Group for the collapse mode (Expanded, Icons only, Hidden) and a list of five items, each with a Toggle that shows or hides it and Move up and Move down buttons. Settings can't be hidden, because it is where this is changed, so it shows a lock in place of a toggle. At the end, the drawn app redraws with every change, with a sentence under it that says what it shows; on a phone it is a strip above the list that stays in view while the list scrolls. Changes apply on the spot, to the drawing only. It's built from Segment Group, Toggle, Button, Shine Button and Guides, with a CSS entrance only. For an analytics or admin app, a dashboard with a customisable menu or any product with a sidebar.
FAQ
How do I fill it with my own navigation?
Edit ITEMS: each item has an id, a label, an icon, whether it is locked (cannot be hidden) and how wide its label bar is drawn. DEFAULTS holds the starting layout, collapse mode, order and the items shown. The count in the heading, the order of the drawn rail and the sentence under the drawing are all worked out from the current state, so nothing is typed twice. To store it, save the layout, collapse mode, order and shown ids per person and read them where you render the real navigation.
How does reordering work, without dragging?
Each row has Move up and Move down buttons named for the item ("Move Projects up"). They stay in place and focusable at the ends and say so when pressed, the status line says where the item went ("Projects moved to position 2 of 5."), and focus follows the item to the row it moved to. The rows are fixed slots whose text changes, so nothing jumps and the list keeps its height.
What do the collapse modes change?
Expanded draws an icon and a label for every item, Icons only draws just the icons, and Hidden draws no navigation at all, only a menu button in the app bar that would open it; the sentence says how many items it holds. They apply to the top bar the same way as to a sidebar at either end.
What does Reset to defaults do, and what stays local?
It puts the layout, collapse mode, order and visibility back, and says so in the status line. While everything is at its default the button is marked aria-disabled rather than disabled, so it keeps its place and focus; pressing it says "Already at the defaults." The drawn app is a picture: this page's own navigation is never touched, and a reload starts from the defaults again.
Is it accessible?
The layout cards are native radios in a named group, so the arrow keys move between them, and each carries its full name ("Sidebar at the start"). The visibility toggles are named for their item ("Show Projects") and pressed when it shows. The drawn app is decorative, and its caption restates it in words. The status line is a polite live region that is present from the start.
How does it look on a phone?
The window keeps its height and the list scrolls inside it. The drawn app becomes a short strip pinned at the top of that scroll, so you always see the result of the toggle you just pressed; its caption is kept for screen readers. The layout cards and the collapse choices share the row width.
Related
- Pro
A reading workspace in a fixed-height window whose sidebar holds three reading lists you reorder by dragging a grip or with Move up and Move down buttons, inside each list only.
- Pro
Custom Width Sidebar
VariantsA hosting platform's settings console in a fixed-height window where the sidebar's width is the control: four presets set its CSS variable, and a measured count shows how many of ten long labels get cut at each.
- Pro
Peek and Pin Icon Sidebar
Icon railsA team workspace in a fixed-height window whose icon rail peeks open over the page on hover or focus without moving it, and a pin makes the open rail push the page and stay.
- Pro
Theme Editor Settings
Appearance and localeA theme editor window: five colour tokens each with a picker, a hex field and a contrast ratio worked out from the hex values, a radius slider and a font select, a Light or Dark set with Dark derived until edited, a drawn sign-up page that wears the tokens and a Copy CSS button.
- Pro
Appearance Settings
Appearance and localeAn appearance settings panel that previews instead of applying: a drawn app window that wears the choices, theme and contrast cards with a drawn thumbnail each, a text-size slider with a sample sentence and a reduce motion switch with a replay.
- Pro
Role Permissions Settings
Team and rolesA roles window with a rail of five roles and a detail of grouped permissions: mixed-state group boxes, a Compare with select that marks each permission with a plus or a minus, read-only system roles and Duplicate to edit.