Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Compact Icon Rail Sidebar Block for React

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.

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

Keep every destination readable in a column 72 pixels wide with this compact icon sidebar for React with Base UI. A window framed by a hairline with a plus mark on each corner holds the Sidebar as a static rail: an icon over a caption for Home, Search, Inbox, Docs, Stats and Team, the open one in a rounded pill, and Alerts and Settings pinned at the foot. Nothing hides and nothing needs a tooltip, so the captions are always the label. A dot sits on Inbox while it holds notes you haven't opened, and clears once you have opened Inbox and moved on. Each destination fills the page with its own list in real text and a count, and Up and Down arrows move through the rail. It's built from Sidebar and Guides, with a CSS entrance only. The rail stays beside the page on a phone, because it fits at 320 pixels. For note apps, mobile-style navigation on the web and any app with a handful of top-level places.

FAQ

How is this different from an icon rail with tooltips?

An icon rail with tooltips hides its labels until you hover or focus an icon; this one never hides them. Every destination is an icon over a short caption, so a first-time visitor can read the whole navigation at a glance, and no tooltip is needed or drawn. It trades width for that: the rail is a fixed 4.5rem column (collapsible="none" with w-18), so it doesn't fold, and it suits six to eight destinations with short names rather than a long tree.

Why does the rail stay on a phone?

The catalog Sidebar turns into a sheet below the medium breakpoint, but a static rail never does: collapsible="none" renders a plain column. At 72 pixels it leaves a page 248 pixels wide at 320, which holds a list of notes with truncated lines, so the navigation stays one tap away instead of behind a menu button. The block has no menu button for that reason.

How does the Inbox dot work?

The dot comes from the data: Inbox holds three typed notes, two of them marked unopened. While they are unopened the rail draws a dot on Inbox, the link's name says "Inbox, 2 new", the page's count line says "3 notes, 2 new" and the rows are bold with a dot. Opening Inbox and then going to another destination marks them seen, the status line says "Inbox read.", and the dot and the counts follow from the same state. The dot is a shape and a weight, never a color.

Which keys work in the rail?

Tab moves through the links like any navigation. On top of that, ArrowDown and ArrowUp move focus to the next and previous destination and wrap at the ends, and Enter opens the focused one. The links are plain anchors to # whose handler shows the page instead of navigating, so they work the same with every library and need no per-library code.

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

Everything. The eight lists are typed in MAIN and FOOT at the top of the file, the counts and times come from them, and the times are measured from one fixed AS_OF, so nothing depends on the clock. Replace the rows with your data and point each link at a route, marking the current one with aria-current="page". Nothing is saved, synced or searched; Settings only lists values.

Is it accessible?

The rail is a navigation landmark named after the product, the open destination is marked as the current page, and each link's name carries what is new in it. The visible captions are part of that name. The icons are decorative. The page's list is a scrollable region you can reach with Tab, and one polite status line says which destination opened. The pill's transition stops under reduced motion.

  • Pro

    A features section for a realtime sync engine: a thin icon rail of six streams and a panel with the stream's name at display size beside a vertical marquee of its sync events, with a visible Pause button.

  • Pro

    Sidebar Toggle Navbar

    Mobile and drawers

    A navbar with a sidebar toggle for a project tracker: a button, the [ key and a tooltip fold a mini sidebar under the bar between icons only and icons with labels, and on phones the same button opens it as a sheet.

  • 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 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

    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.

  • Pro

    A project workspace in a fixed-height window whose sidebar rows each hold Pin, Duplicate and Archive buttons, with a real Undo in the footer that puts an archived project back in its old place.