Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Help Center Search Navbar Block for React

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.

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

A help-centre navbar for React with Base UI, the bar a support site keeps above its articles. For Beaconhelp, support-desk software, the wordmark leads, four category links follow, and a search field and an outline Contact support button close the row. Focusing the field or typing opens a popup of eight help articles and four categories in two labelled groups: an article shows a page icon, its title, its category and its reading time; a category shows a folder icon and how many articles it holds. The list narrows as you type, by title or category, ignoring case and accents, and the letters that match are marked. When nothing matches, the popup says what had no result and offers an Ask support link rather than a dead end. Press "/" anywhere on the page that isn't a text field and the field takes focus. The popup is portalled, so the bar stays one bar high (64 pixels, 56 on a phone) while it is open. On a phone a search button replaces the bar with the field, and a menu button opens a sheet from the top with the categories and Contact support. It's built from Autocomplete, InputGroup, Kbd, Sheet, Button and Guides with Lucide icons and your theme's tokens for every colour. For help centres, knowledge bases and support sites that want articles one key away.

FAQ

How do I change the articles and make a pick do something?

Edit ENTRIES at the top of the file: each row is an article or a category, with a title, a category, a note under the title ("3 min read", "12 articles"), a group label and a value. Picking a row puts its title in the field, as an autocomplete does. To open the page, pass onValueChange to Autocomplete: it receives the picked value, which you can map to a route. To search a real index, replace matching(query) with your own results, fetched or local; the popup renders whatever the collection holds, in the groups the rows name.

How does the filtering work, and what are the marked letters?

The collection is rebuilt from the typed text on every change. A row matches when its title or its category holds the text, compared without case or accents, so "billing" finds the Billing category and both Billing articles, and "tickets" finds the two articles with tickets in their titles. A group with no match disappears with its label. The matching letters sit on a light tint of the text colour, so the words keep their contrast in every theme.

What shows when nothing matches, and how does a keyboard reach it?

The popup says "No articles match" followed by the text, in a bdi so it reads right in any direction, and shows an Ask support row as a link. Because it is a plain link inside the popup, a keyboard user reaches the same destination through the Contact support button in the bar (or the sheet on a phone), which stays one Tab away. Point both at your contact page.

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

The field is a combobox with an accessible name and the popup is a listbox of options in labelled groups. The arrow keys move through the rows, Enter picks one and Escape closes the popup, leaving focus in the field. The field declares the "/" key with aria-keyshortcuts, and the key cap is hidden from screen readers because it's a hint, not a control. The search sits in a search landmark named Help center, and the category links in a nav named Main with the current one marked aria-current="page". The popup behaves the same on every library: it is built on the same combobox everywhere.

How does it work on a phone?

Below the md breakpoint the bar shows the wordmark, a search button and a menu button. The search button says whether the search is open and which landmark it controls; pressing it (or "/") replaces the bar with the field, which takes the keyboard, and turns the button into a close button in the same place. Escape closes the popup first and ends the search second, and focus returns to the search button. The menu button opens a sheet from the top whose header lines up with the bar, with the four categories and Contact support; choosing a link closes it and Escape returns focus to the menu button. Nothing wraps at 320 pixels, and the popup is as wide as the screen allows.

How does it sit on the page, and can it stick to the top?

The navbar is the page's first block: its + marks and rails line up with every block under it, its top rule falls on the window's top edge, and it draws no bottom border, because the next block's top rule is its bottom edge. To keep the bar in view while the page scrolls, add sticky top-0 z-40 bg-background/80 backdrop-blur to the header; the popup still opens under it.

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

  • Pro

    A navbar for a video site with a wide search that brings back your recent searches on focus, each with a clock icon and its own remove button, narrowing as you type with suggestions beneath.

  • 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 documentation search field in a slim bar: an icon, a labelled input and a slash key hint, with a popup of results that filters as you type.

  • Pro

    A searchable FAQ for a notes app: a start-aligned header, a band with a full-width search field and a live count, and ten questions that filter as you type, open every match and mark the matched words.