Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Dual Column Sidebar Block for React

A site builder in a fixed-height window whose single sidebar is two columns: an icon rail of sections and, beside it, a panel of the browsed section's pages, with the open page kept across sections.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Give two levels of navigation one sidebar with this dual column sidebar for React with Base UI. A window framed by a hairline with a plus mark on each corner holds one Sidebar, 22rem wide, drawn as two columns: a rail of icon Buttons for Marketing, Shop, Journal and Help, each with a Tooltip, and beside it a panel listing the pages of the section you are browsing, each with its status. Open a page in one section and browse another: the page stays open, the section that holds it keeps aria-current and wears a dot, and its pages are one press away. The page shows the open page's name, a sentence and a Data List of its path, template, status, edit date and owner. Up and Down move between the section buttons. Folded to icons, the panel goes and the rail stays, and a section button unfolds it again; on a phone both columns are in the sheet. It's built from Sidebar, Button, Tooltip, Data List, Badge, Avatar and Guides, with a CSS entrance only. For site builders, settings, docs and any app with sections that have pages.

FAQ

How are two columns built inside one Sidebar?

The catalog Sidebar draws a single column at --sidebar-width, which this block sets to 22rem on the provider. Inside it the block puts one flex row: a 3rem rail with the section buttons, and a panel that takes the rest. Because the rail is as wide as the icon-collapsed sidebar (3rem), folding the Sidebar to icons leaves exactly the rail; the panel carries in-data-[collapsible=icon]:hidden and goes with the labels. No second Sidebar and no extra state are involved: the fold, the trigger, the edge rail and the phone sheet are the catalog's own.

What is the dot on a section?

The block keeps two things: the open page, and the section you are browsing. They differ once you press another section's button. The button of the section that holds the open page keeps aria-current="true" and its name becomes "Shop, holds the open page"; while you browse elsewhere it also wears a small dot, so you can find your way back. The pressed button is the one whose panel is showing (aria-pressed). Choosing a page in the panel opens it and makes its section the browsed one.

Which keys work in the rail?

Tab reaches the section buttons like any buttons, and ArrowDown and ArrowUp move focus between them, wrapping at the ends; Enter or Space presses the focused one. Each button shows a tooltip on hover and on focus. In the panel the page links are ordinary links, with the open one marked as the current page.

What stays in the page, and how do I connect it?

Everything. The thirteen pages are typed in SECTIONS with their path, template, status, date and owner, and nothing is published, saved or renamed. The times are measured from one fixed AS_OF. Replace the data with your site's pages and point each link at a route. The page links go to # whose handler shows the page instead of navigating. They're SidebarMenuButtons with render set to an a element.

How does it work on a phone?

Below the medium breakpoint the sidebar is a sheet, 18rem wide, that the menu button in the top bar opens from the start edge, the right in a right-to-left layout. Both columns are in it: the rail's buttons switch the section whose pages are listed, and choosing a page closes the sheet, puts focus back on the button and shows the page behind it. The window keeps its height, and the status line says what opened.

Is it accessible?

The rail is a navigation landmark named "Pageloom sections" and the panel another, named after the browsed section. Every section button has a name that says whether it holds the open page, and a tooltip; each page link's name carries its status ("Cart, scheduled"). The heading above the pages names the section and counts them. One polite status line reports each choice, and tooltips open for keyboard focus as they do for the pointer.

  • Pro

    A 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

    A note-taking app in a fixed-height window whose narrow rail keeps a caption under every icon, with a pill on the open destination, a dot on Inbox while it holds unopened notes and Alerts and Settings pinned at the foot.

  • Pro

    A messaging app in a fixed-height window whose icon rail opens a menu card beside each icon on hover or focus, with the section's name, one line and its links; choosing a link sets the page and the top bar shows the path.

  • Pro

    Tab Groups Sidebar

    Headers and sections

    A markdown editor in a fixed-height window whose sidebar has a tab strip over its list, switching between Files, the open file's Outline and Bookmarks, each keeping its own selection and marking the chosen line in the document.

  • Pro

    A grocery app in a fixed-height window whose inset sidebar drills down one level at a time, panel by panel up to four levels deep, with a back button, Escape and a breadcrumb that all go up.

  • Pro

    A mail client in a fixed-height window: mailboxes and labels whose counts follow the mail you file, a searchable message list beside the open message, and Compose for a local draft.