Navbar, search


Install
npx shadcn add https://ui.klarhimmel.com/r/navbar-search.jsonDetailsAbout, usage, props and more
A shop header: the brand, a wide rounded search field, round account and basket buttons, then a row of category links under a rule.
Import
Import
- navigation/search
- header/search
- About
- A shop header: the brand, a wide rounded search field, round account and basket buttons, then a row of category links under a rule. On a phone the search drops to its own full-width line and the links wrap.
- Category
- The bar at the top of every page: brand, links, one action. New project? Set it up once: /get-started/installation.
Notes
When to use it
A shop header with a wide search field, round account and basket buttons and a row of category links. Choose navbar-simple when the site has no catalogue to search, and navbar-menu when the links need dropdowns.
Writing for it
- The search form submits a plain GET to its action address with the words in q, so point the action at the page that lists results and it works with no script.
- Name each round button for what it opens, such as account or basket, because the label is the only text a screen reader gets for an icon.
- Keep the category row to the handful of departments people actually shop by, since it wraps onto more lines instead of folding into a menu.
Watch out for
On a phone the search drops to its own full-width line and the category links wrap beneath it, so a long row of categories makes the header tall. Test it at 390 px before adding a ninth link.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
brand | string | 'Write the business name' | Text, up to 40 characters. |
mark | { paths, viewBox, src } | - | Fields: paths (optional), viewBox (optional), src (optional). Optional; empty is not rendered. |
brandHref | string | - | Text, up to 300 characters. Optional; empty is not rendered. |
search | { label, placeholder, href } | {…} | Fields: label, placeholder, href. |
actions | { icon, label, href }[] | 2 items | List of up to 3. Each item: icon ('account' | 'basket' | 'heart'), label, href. |
links | Link[] | 5 items | List of 1 to 10. |
linksLabel | string | 'Name the category row' | Text, up to 60 characters. |