Nav bar
The Krizaka navigation bar, the same on every site of the family: a floating pill that tightens as the page scrolls, the family switcher on the brand, one light that glides to the item under the pointer or the focus and rests on the current page, accessible menus with rich links, and a mobile panel.
- Domain
- Navigation & shell
- Support level
- Size
- 21.3 kB gzip, budget 27.6 kB
- Who uses it
- 19 files of the live products and sites import it (Verikora: 2, Folioviv: 4, Sovkora: 3, krizaka.com: 2) Counted in the dated inventory of 2026-11-23.
import { NavBar, ProductBarActions, productBarActions } from "@krizaka/ui/nav-bar";Web only — React, from @krizaka/ui/nav-bar. Beta: its API may still change in a minor version.
- Mobile · n/a. A site's top bar; an app on a phone navigates with its tab bar. → Tab bar
- Desktop · n/a. A public site's page, not a window of the Mac app.
Why it is here. Used by Sovkora, Verikora, Folioviv, krizaka.com.
When to use
- The top navigation of a site or a product: a brand, a few links, one or two menus, actions on the right.
- A section bar inside an app (
floating={false}): videos, earnings, auctions. - Every site of the Krizaka family (www, ui., java., dev.<product>, admin.<product>): the brand and
NavBar.Familyon the left, at most four of the site's sections in the middle, the tools on the right.
When not to use
- To switch views inside a page without changing the address.Use instead: Tabs
- For a list of actions on one object.Use instead: Dropdown menu
- For search and commands across the app.Use instead: Command
- To link to another site of the family from the bar's middle: the family switcher holds them.Use instead: Sites
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { NavBar, ProductBarActions, productBarActions } from "@krizaka/ui/nav-bar";Examples
www.krizaka.com
The company's bar: the mark and the family switcher, Products · Open source · Our story, the repository and Contact. Open the chevron: every site of Krizaka, grouped, the current one marked.
ui.krizaka.com
Krizaka UI: the family, the version of the packages, Get started · Foundations · Components · Templates, the repository.
java.krizaka.com
Krizaka Java: the family, the version of the building blocks, Get started · Building blocks · Guides.
dev.<product>
A product's site, the standard of every Krizaka product: its mark alone, Product ▾ · Platforms ▾ · Docs with menus (icon · title · a description of two lines), the repository, the theme, the language, Sign in and “Talk to us”; the phone panel groups the same entries and ends with the preferences.
A public site
A product's public page (a shared export): no sign-in and no try action, so the actions block renders nothing and the bar shows no way in.
admin.<product>
A console: the mark, the family and DEV, no sections, a full-width bar.
A site's bar
Brand, a Products menu, links, a call to action, a mobile panel — hover the items: one light glides between them.
A rich menu
Two columns of links with icons whose node lights up, the current page tinted.
Inside an app
floating={false}: a full-width bar with a hairline, for an app's sections.
Props
NavBarRoot
The bar. Place it in a sticky top-3 (floating) or sticky top-0 wrapper — or let it scroll.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | The accessible name of the navigation (“Main”) — passed translated. |
compactAfter | number | false | 24 | Pixels of scroll after which the bar tightens (denser, lower, lifted). false: never. |
floating | boolean | true | A floating pill (the Krizaka bar) or a full-width bar with a hairline under it. |
NavBarBrand
The brand: a mark and a name, linking home.
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Renders your link (a router <Link>) with the brand's look. |
org | Pick<OrgFacts, "brand"> | — | The organisation's facts (org of @krizaka/org): without children, the brand is the Krizaka mark and org.brand.name,
so no site writes the company's name by hand. Children, when given, win (a product's own brand). |
NavBarFamily
| Prop | Type | Default | Description |
|---|---|---|---|
currentrequired | SiteId | — | The site this bar belongs to (@krizaka/ui/sites): marked in the family, aria-current="true". |
className | string | — | Classes of the switcher (or, inside NavBar.Mobile, of the family's group). |
defaultOpen | boolean | — | Opens the panel at first render (a story, a screenshot). |
labels | FamilyLabels | familyLabels.en | The family's words, passed translated: familyLabels.fr from @krizaka/ui/sites, or your own of the same shape. |
NavBarBadge
A small mono badge beside the brand: the environment and the version (DEV · v1.2.3). Hidden below sm.
| Prop | Type | Default | Description |
|---|---|---|---|
env | string | — | The environment, when it is not production (DEV). |
version | string | — | The version the site runs (1.2.3, shown v1.2.3). |
NavBarLink
A link of the bar. asChild renders your router's <Link>.
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | — | The current page: aria-current="page", and the light rests on it. |
itemClassName | string | — | Classes on the list item around the link (to show it from a breakpoint only). |
NavBarMenu
A menu of the bar: its trigger, and its links in a panel that opens under the bar. A menu of inlineUpTo links or
fewer (3 by default) is not a menu at all: its links stand in the bar, each with its active state — a hidden list of
three is one click more for nothing. The phone's panel groups them as usual (NavBar.MobileGroup).
| Prop | Type | Default | Description |
|---|---|---|---|
childrenrequired | ReactNode | — | The menu's links (NavBar.MenuLink), laid out in a panel; columns sets the grid. |
labelrequired | string | — | The trigger's words (“Products”) — passed translated. |
active | boolean | — | The current page is inside this menu: the light rests on its trigger. |
columns | 1 | 2 | 1 | Columns of the panel. |
inlineFrom | "lg" | "md" | "xl" | lg | From which breakpoint the inline links stand in the bar. Below it (between the phone panel at md and this
breakpoint) the section is the dropdown, so long labels never overflow a tablet-width bar. md inlines as soon as
the bar is shown. |
inlineUpTo | number | 3 | A section with this many links or fewer needs no hidden list: they sit in the bar as plain links (the active one
marked, no dropdown, label unused on the desktop). Above it, a dropdown. 0 always makes a dropdown. |
NavBarMenuLink
A link inside a menu: an icon, a name and a line of text.
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | string | — | The link's name — passed translated. |
active | boolean | — | The current page. |
description | string | — | One line under it — passed translated. |
icon | ReactNode | — | An icon (a signature icon of @krizaka/icons: its node lights up on hover). |
NavBarRepo
The site's repository on GitHub, an icon link of NavBar.Actions.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | The link's accessible name (“Source on GitHub”) — passed translated. |
NavBarSession
The bar's session island: put it in NavBar.Actions. While the answer is on its way it reserves the place and says
hint politely (or, given initial, draws the server's answer at once); if the first request fails it shows the
signed-out actions (the visitor can still sign in).
| Prop | Type | Default | Description |
|---|---|---|---|
hintrequired | string | — | The hint's words while the answer is on its way (“Checking your session…”) — passed translated. |
signedInrequired | (account: TAccount, state: { signupOpen: boolean; }) => ReactNode | — | Signed in: the product's AccountMenu, given the account. |
signedOutrequired | (state: { signupOpen: boolean; }) => ReactNode | — | Signed out: the product's ProductBarActions, told whether sign-up is open. |
className | string | — | Classes of the loading placeholder. |
endpoint | string | /api/me | Where the contract is served. |
initial | MeResponse<TAccount> | — | The session the server already knows (a dynamic page reading its cookie): the first paint then IS the answer, with no placeholder and no swap. Leave it out on a static page; the bar reserves its place until the answer comes. |
sessionHint | boolean | — | The server's hint that a session cookie exists (krizaka-ui#827): while the answer is on its way the bar then reserves
a signed-in placeholder (account-sized, data-state="signed-in-pending") instead of an empty place, and never the
« Sign in » action. A hint, never the proof: /api/me still decides. Left out, it is read from the family's readable
flag cookie (kz-session=1, kept by sessionHint of @krizaka/auth in the proxy), so a static page needs no prop. |
NavBarLanguage
The language switch, the same on every site: in the bar a globe and the current code (FR) opening a short menu of
the languages by their own names; inside NavBar.Mobile the same languages as a row in the preferences.
| Prop | Type | Default | Description |
|---|---|---|---|
currentrequired | string | — | The code of the page's language (fr). |
labelrequired | string | — | The control's accessible name (“Language”, “Langue”) — passed translated. |
languagesrequired | readonly Language[] | — | The languages offered, each with its name in its own language and the address of the same page (languagesFor). |
className | string | — | Classes of the control. |
defaultOpen | boolean | — | Opens the menu at first render (a story, a screenshot). |
linkAs | ElementType<any, keyof IntrinsicElements> | — | Your router's <Link> (it receives href, hrefLang, lang). A plain <a> otherwise. |
NavBarMobile
Below md: a toggle, and a panel under the bar with its links (NavBar.MobileLink), grouped like the bar's menus
(NavBar.MobileGroup). A disclosure: Escape, a click on a link or a press outside close it; Escape returns the focus
to the toggle.
| Prop | Type | Default | Description |
|---|---|---|---|
closeLabelrequired | string | — | The toggle's name when open (“Close the menu”) — passed translated. |
openLabelrequired | string | — | The toggle's name when closed (“Open the menu”) — passed translated. |
NavBarMobilePreferences
The last group of the mobile panel: the preferences (theme, NavBar.Language), in a row under their heading.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | The group's heading (“Preferences”) — passed translated. |
NavBarMobileGroup
A group of the mobile panel: the links of one of the bar's menus under its name, in the same order.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | The group's heading — the same words as the bar's menu (“Product”) — passed translated. |
NavBarMobileLink
A link of the mobile panel.
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | — | The current page. |
asChild | boolean | — | Renders your router's <Link>. |
ProductBarActions
The product bar's actions: use the app. Put it in NavBar.Actions (placement="bar") or in NavBar.Mobile (placement="panel").
| Prop | Type | Default | Description |
|---|---|---|---|
signupOpenrequired | boolean | — | Whether the product accepts new accounts (its signupOpen setting): « Try » is the primary action only then. |
linkAs | ElementType<any, keyof IntrinsicElements> | a | The app's link component (Next's Link); an <a> otherwise. |
placement | "bar" | "panel" | bar | bar (from md, the buttons of the bar) or panel (the mobile panel: full-width, the primary last). |
signIn | ProductBarLink | — | Where « Sign in » leads, and its words. Absent on a public site: with no tryIt either, the block renders nothing. |
tryIt | ProductBarLink | — | « Try for free » (the first audit is free), the founder offer: absent when the product has none. |
Accessibility
- A
navnamed bylabel, a list of links and menu triggers (Radix NavigationMenu):aria-expandedandaria-controlson each trigger. - The mobile panel is a disclosure (no focus trap): its toggle is named by
openLabel/closeLabeland saysaria-expanded; a press outside closes it.NavBar.MobileGroupis agroupnamed by its heading. - Menus open on click, Enter, Space or ↓, or when the pointer rests on the trigger (
delayDuration, 200 ms) — passing over the bar opens nothing. While a menu is open the light stays on its trigger; moving on to a plain link closes the menu. - The light, the chevron and the tightening do not move under
prefers-reduced-motion; the current page is tinted before scripts load. - The family is its own
navnamed bylabels.family; its chevron is a button with the same name,aria-expandedandaria-controls. Each group is a list named by its heading, the current site saysaria-current="true"and “You are here”, a site not released says its status in words. NavBar.Repois an icon link named bylabel;NavBar.Badgeis plain text (DEV · v1.2.3), hidden belowsm.
Keyboard
| Keys | Action |
|---|---|
| Tab | Moves between the brand, the items and the actions; leaving an open menu closes it. |
| Enter / Space / ↓ | Opens a menu and moves into it. |
| ↑ / ↓ · Home / End | Walks the links of an open menu. |
| ← / → | Moves between the items of the bar. |
| Esc | Closes the menu, the family or the mobile panel and returns the focus to its trigger. |
| Click outside | Closes the open menu or the mobile panel. |
| Enter / Space / ↓ (family) | Opens the family from its chevron; ↑ / ↓ walk the sites. It never opens on hover. |
Best practices
- The company's bar:
<NavBar.Brand href=… org={org} />withorgof@krizaka/orgis the Krizaka mark and the brand name, so no site writes the company's name by hand; a product keeps its own children. - A product's bar ends with
ProductBarActions: the primary action is using the app (« Sign in » while sign-up is closed, « Try » once it opens, from the product'ssignupOpensetting), « Sign in » never twice, and no « Contact » or « Talk to us » — contact is a plain link in the footer. krizaka.com, the company site, keeps its « Contact us ». - Who is here is one contract for every product:
GET /api/meanswers 200{ signedIn, signupOpen, account? }withCache-Control: private, no-storeandVary: Cookie(import { meResponse } from "@krizaka/ui/nav-bar/me"in a route handler or server module), signed out is never a 401.NavBar.Session(inNavBar.Actions, needs a@krizaka/queryprovider) asks it and shows yourProductBarActionsor your account menu — never a local copy of the island. Pending is neither state (the bar reserves its place), a failed refetch keeps the last known state, and a dynamic page passesinitial(its server-read session) so the first paint is the answer; A static page needs no prop: the proxy keeps the readablekz-session=1flag next to the HttpOnly cookie (sessionHintof@krizaka/auth, which also answers 307 from the landing route to the home withlandingRedirect),NavBar.Sessionreads it (orsessionHintfrom a dynamic page) and reserves a signed-in placeholder while/api/meanswers, so a signed-in person never sees « Sign in » first; the flag is a hint, never an authorization.useNavSessionis the same reading for a hero or closing action, so they never disagree. - Five items at most on the bar; group the rest in a menu, each link with a name and one short line (
NavBar.MenuLink, one line, ≤ 45 characters). - A product's site (dev.<product>, see Navigation in the family): the product's mark alone (no
NavBar.Family, no badge — the version goes in the footer), then **Product ▾** (what it does: how it works, its features, the demo) · **Platforms ▾** (web, mobile, desktop, self-host — omitted for a single-platform product) · **Docs** · Pricing when it exists; never a lone entry that belongs to a group (no top-level Demo, Mobile or Mac). The phone panel repeats the groups withNavBar.MobileGroup, in the same order. - A menu of three links or fewer is not a menu:
NavBar.Menuputs them in the bar as plain links (the current one marked, no dropdown) —inlineUpTo, 3 by default,0to keep a dropdown. Above three, the dropdown. The phone panel groups them withNavBar.MobileGroupeither way. - Light one item at most: the group that holds the page (
activeon itsNavBar.Menu), never two. - Mark the current page with
active: the light rests on it,aria-current="page"says it. - Use your router's link with
asChildonNavBar.Link,NavBar.MenuLinkandNavBar.MobileLink. - One primary action at most in
NavBar.Actions(aButtonsize="sm"shape="pill"). - Wrap it in a
sticky top-3(floating) orsticky top-0container to keep it on screen. - Three zones on every Krizaka site: who I am (
NavBar.Brand+NavBar.Family current="<site>", thenNavBar.Badgewith the version orDEV · v1.2.3), this site (at most four sections, never a link to another site), tools (search when there is something to search,NavBar.Repo, theme, language, one primary action). - The language is
NavBar.Language, the same on every site: a globe and the current code (FR) opening a menu of the languages named in their own language (languagesFor(pathname)), never a pill naming the other language. InNavBar.Mobileit renders as a row, insideNavBar.MobilePreferenceswith the theme. - Menu links: a name and a description that wraps on two lines at most (≤ 90 characters); the panel is 28 rem wide (40 rem in two columns), aligned under its trigger and kept inside the page.
- Place a second
NavBar.Familyas the last child ofNavBar.Mobile: belowmdthe family is the panel's last group. - Pass the family's words translated:
labels={familyLabels[locale]}from@krizaka/ui/sites.
Related components
Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub