Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Page Stack Breadcrumb Command Menu Block for React

A CMS page browser as a command menu shown open as a page stack: a trail of crumbs over the list, the arrow keys go into a folder and back out, and a page closes the menu and names itself on the page list behind.

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

Go into a folder and back out without leaving the keyboard with this page stack command menu for React with Base UI. It opens from the Pages screen of Pageholm, a CMS, whose header holds an outline field with its ⌘ K cap, and the page list is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The menu is the catalog Command over a trail of crumbs made with the catalog Breadcrumb: it opens at Home, Settings and goes as deep as Home, Settings, Billing. It shows one level of the site at a time, folders first and pages after, each folder with its item count. The arrow toward the end, or Enter, on a folder goes in: the list is replaced by that folder's, the search placeholder reads Search in Billing and the foot counts 7 items. The arrow toward the start, or Backspace on an empty input, goes up one level, and a crumb jumps straight back to its level. A page closes the menu and names itself on the chip in the drawn page list. Nothing is opened or saved. For preview the menu is drawn open in place when the page loads; the field, or Ctrl or ⌘ K while focus is in the block, opens the real command dialog at the same level with the same query. For CMSs, file managers, settings trees and any product whose things live in folders.

FAQ

Why is the menu already open, and what do I keep?

So you can see it without a click. On load the menu is the Command drawn inline over a picture of the page list, in a plain shell that is not modal, so nothing is trapped, hidden or focused and the page around the preview keeps working. The header's field opens the real command dialog, modal, with its focus trap, Escape and focus return, and the inline copy stays closed until a reload. Both show the same Palette and share the block's state, so the level you reached in the copy is the level the dialog opens at. In your app keep the dialog and drop the copy: the "in-place" state, the scrim with its shell and the Escape and blur effects.

How does the page stack work?

The block keeps one string, the id of the level that is open (the folder's path, or an empty string for Home), and everything else is a function of it: the rows are the entries whose parent is that level, the crumbs are every prefix of the path, and the placeholder and the foot read its name and its count. Going in or out changes the string, clears the search, replaces the list and says where you are ("In Billing, 7 items."). Escape closes the menu and keeps the level, so the next opening is where you left off; choosing a page ends the visit and goes back to Home.

Which keys go in and out, and do they fight the input?

They only act when they mean nothing else. The arrow toward the end goes into the highlighted folder only while the caret is at the end of the text, so it still moves the caret in the middle of a word. The arrow toward the start and Backspace go up only while the input is empty, so they still delete and move the caret otherwise. In a right-to-left page the two arrows swap, and the key hints in the foot mirror with them. On a phone the rows and the crumbs are the way in and out.

What stays local, and how do I wire it?

All of it. The site tree is typed data (ENTRIES, each with an id that is its path), no page is loaded and nothing is saved; choosing a page only moves the chip in the drawing and the status line. In your app build ENTRIES from your content tree, give each entry its parent's path in its id, and make pick navigate to the page.

Is it accessible from the keyboard?

Yes. Type to search inside the level, the arrow keys move through the rows, Enter opens the highlighted row and Escape closes the menu and puts focus on the field; the crumbs are buttons in the tab order. Ctrl or ⌘ K opens the dialog while focus is inside the block, and only then. The rows are options of a cmdk listbox; the block turns off its own fuzzy filter and lists the rows itself.

How does it look on a phone?

The copy shown on load docks to the top of the page at full width, so the keyboard does not cover the foot. The key hints go and the count stays. The trail scrolls sideways when it is longer than the menu and stays on its last crumb, so the level you are in is always in view.

  • Pro

    An API docs host's page finder as a command menu shown open on a tree: sections open into indented pages with the arrow keys, typing flattens the tree and matches the headings inside pages, and the foot counts the open sections.

  • Pro

    A bank back office's navigation menu shown open: 24 pages in three levels, each row the name over its whole path, a search that reads the path by the start of each word, and a tick on the page you are on.

  • Pro

    A payload inspector's path browser as a command menu shown open beside a value pane: the keys of an object or array with their type as a word, a path bar in monospace, the arrow keys going in and out, a typed path that jumps there, and a copy path button.

  • Pro

    A cloud drive's quick open as a command menu shown open at the top of a file manager: recent files first, a search across every folder, middle-shortened paths with sizes and dates, kind chips and a sort, and the chosen row selected in the table behind.

  • Pro

    An app page header: a Back button, the trail with the current page's title and a Draft badge, then behind a split divider who edited it and how long ago, and a Settings link.

  • Pro

    Basic Command Menu

    Search everything

    A team workspace's home page with its command menu shown open: eleven pages in three groups, a shortcut on the five most used, matches marked, an empty state that says what to try and a foot with the key hints and a spoken count.