Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Scoped Record Search Navbar Block for React

An admin navbar for a marketplace console: a sidebar toggle, a search field scoped to Users, Orders or Logs, and a badge that counts pending approvals.

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

An admin navbar for React with Base UI, the bar across Gaffwell, a marketplace console. A sidebar toggle sits at the start, with a [ key hint beside it. The search field takes a scope (Users, Orders or Logs) and lists only that scope's records as you type. A badge counts the pending rows in the typed list, then Approvals, Sellers and Payouts follow, Approvals marked as the current page. Below the md breakpoint a search button opens a sheet from the top that holds the same field. The suggestions and the sheet open over the page, so the block stays one bar high (56 pixels). The page's rails and top rule come from the Guides spine and the bar draws no bottom border: the next block's top rule is its bottom edge. It's built from Autocomplete, Native Select, Input Group, Badge, Button, Kbd, Sheet and Guides, with your theme's tokens for every colour. For marketplace and operations consoles whose header has to search one kind of record at a time.

FAQ

How do I change the scopes, the records and the links?

Edit SCOPES for the select (each scope is an id and a label), ENTRIES for the records (a title, a one-line detail, a scope and pending) and PAGES for the links. The field, the empty state and the badge all read ENTRIES, so a new pending row shows up in the count without a second list. Mark the page you're on with current: true: that link gets aria-current="page", which draws a stroke on the bar's bottom edge. Every link points at #: point them at your pages.

What does the sidebar toggle do?

It flips expanded in the block and says so in a polite line the toggle names with aria-controls ("Sidebar expanded." or "Sidebar collapsed."). The button's label switches between Expand sidebar and Collapse sidebar, and aria-expanded follows. Pressing [ does the same, unless you are typing in a field, the key is held with a modifier, or the target is editable. There is no second panel in this block: the line is the whole effect, so a real app can listen for the same state and show its rail.

How does it work with a keyboard and a screen reader?

The toggle is a button named Expand sidebar or Collapse sidebar, with the shortcut announced. Tab then reaches the wordmark (a link home), the search field and its scope select, the pending badge's text, and the links in a nav landmark named Main. The suggestions are a listbox on the field. Escape closes the list. The [ key is ignored while a text field, including this search, has focus.

How does it work on a phone?

Below the lg breakpoint the links hide, and below md the field hides too. At 320 pixels the bar is the toggle, the wordmark, the pending count and a search button, and nothing wraps. The search button opens a sheet from the top with the same scoped field. Focus moves into the sheet; Escape or the close button closes it and returns focus to the search button. The badge keeps the number and hides the word "pending" below sm.

What moves, and what happens with reduced motion?

Nothing moves on load: the navbar is chrome and is simply there. The suggestion list opens with the popup's own transition, and the sheet slides down from the top. With reduced motion the sheet appears without sliding.

  • 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 navbar for a legal-research database whose field-looking search button opens a panel from the top with a large input, recent searches you can remove, popular topic tags and live results with the matching letters marked.

  • Pro

    A navbar for a notes app with a field-looking button and a shortcut that open a command palette: recent notes first, then pages, actions and settings in labelled groups, with the keys that work shown beside each row.

  • Pro

    A navbar for a support-desk product with a search field whose popup lists help articles and categories in two labelled groups, marks the matching letters, and offers an Ask support link when nothing matches.

  • Pro

    Environment Switcher Navbar

    Accounts and scopes

    An app bar with a Production, Staging and Development segment control that shows the environment's base URL with a copy button and asks for confirmation before switching to Production.

  • Pro

    A navbar for an add-on store with a Categories menu of six categories and their counts, and a search whose popup lists add-ons with an icon tile, drawn stars, an install count and a category.