Krizaka UI
Krizaka UI

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.

Web · ✓Mobile · n/aBureau · n/aBêtaNavigation
Niveau de support
Bêta
Taille
21.3 kB gzip, budget 27.6 kB
Qui l'utilise
19 fichiers des produits et sites en production l'importent (Verikora : 2, Folioviv : 4, Sovkora : 3, krizaka.com : 2) Compté dans l'inventaire daté du 2026-11-23.
import { NavBar, ProductBarActions, productBarActions } from "@krizaka/ui/nav-bar";

Web uniquement — React, depuis @krizaka/ui/nav-bar. Bêta : son API peut encore changer à une version mineure.

  • Mobile · n/a. A site's top bar; an app on a phone navigates with its tab bar. → Tab bar
  • Bureau · n/a. A public site's page, not a window of the Mac app.

Pourquoi il est là. Used by Sovkora, Verikora, Folioviv, krizaka.com.

Quand l’utiliser

  • 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.Family on the left, at most four of the site's sections in the middle, the tools on the right.

Quand ne pas l’utiliser

  • To switch views inside a page without changing the address.À la place : Tabs
  • For a list of actions on one object.À la place : Dropdown menu
  • For search and commands across the app.À la place : Command
  • To link to another site of the family from the bar's middle: the family switcher holds them.À la place : Sites

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Importer

import { NavBar, ProductBarActions, productBarActions } from "@krizaka/ui/nav-bar";

Exemples

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.

PropTypeDéfautDescription
labelrequisstring—The accessible name of the navigation (“Main”) — passed translated.
compactAfternumber | false24Pixels of scroll after which the bar tightens (denser, lower, lifted). false: never.
floatingbooleantrueA 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.

PropTypeDéfautDescription
asChildboolean—Renders your link (a router <Link>) with the brand's look.
orgPick<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

PropTypeDéfautDescription
currentrequisSiteId—The site this bar belongs to (@krizaka/ui/sites): marked in the family, aria-current="true".
classNamestring—Classes of the switcher (or, inside NavBar.Mobile, of the family's group).
defaultOpenboolean—Opens the panel at first render (a story, a screenshot).
labelsFamilyLabelsfamilyLabels.enThe 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.

PropTypeDéfautDescription
envstring—The environment, when it is not production (DEV).
versionstring—The version the site runs (1.2.3, shown v1.2.3).

NavBarLink

A link of the bar. asChild renders your router's <Link>.

PropTypeDéfautDescription
activeboolean—The current page: aria-current="page", and the light rests on it.
itemClassNamestring—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).

PropTypeDéfautDescription
childrenrequisReactNode—The menu's links (NavBar.MenuLink), laid out in a panel; columns sets the grid.
labelrequisstring—The trigger's words (“Products”) — passed translated.
activeboolean—The current page is inside this menu: the light rests on its trigger.
columns1 | 21Columns of the panel.
inlineFrom"lg" | "md" | "xl"lgFrom 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.
inlineUpTonumber3A 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.

PropTypeDéfautDescription
titlerequisstring—The link's name — passed translated.
activeboolean—The current page.
descriptionstring—One line under it — passed translated.
iconReactNode—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.

PropTypeDéfautDescription
labelrequisstring—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).

PropTypeDéfautDescription
hintrequisstring—The hint's words while the answer is on its way (“Checking your session…”) — passed translated.
signedInrequis(account: TAccount, state: { signupOpen: boolean; }) => ReactNode—Signed in: the product's AccountMenu, given the account.
signedOutrequis(state: { signupOpen: boolean; }) => ReactNode—Signed out: the product's ProductBarActions, told whether sign-up is open.
classNamestring—Classes of the loading placeholder.
endpointstring/api/meWhere the contract is served.
initialMeResponse<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.
sessionHintboolean—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.

PropTypeDéfautDescription
currentrequisstring—The code of the page's language (fr).
labelrequisstring—The control's accessible name (“Language”, “Langue”) — passed translated.
languagesrequisreadonly Language[]—The languages offered, each with its name in its own language and the address of the same page (languagesFor).
classNamestring—Classes of the control.
defaultOpenboolean—Opens the menu at first render (a story, a screenshot).
linkAsElementType<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.

PropTypeDéfautDescription
closeLabelrequisstring—The toggle's name when open (“Close the menu”) — passed translated.
openLabelrequisstring—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.

PropTypeDéfautDescription
labelrequisstring—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.

PropTypeDéfautDescription
labelrequisstring—The group's heading — the same words as the bar's menu (“Product”) — passed translated.

NavBarMobileLink

A link of the mobile panel.

PropTypeDéfautDescription
activeboolean—The current page.
asChildboolean—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").

PropTypeDéfautDescription
signupOpenrequisboolean—Whether the product accepts new accounts (its signupOpen setting): « Try » is the primary action only then.
linkAsElementType<any, keyof IntrinsicElements>aThe app's link component (Next's Link); an <a> otherwise.
placement"bar" | "panel"barbar (from md, the buttons of the bar) or panel (the mobile panel: full-width, the primary last).
signInProductBarLink—Where « Sign in » leads, and its words. Absent on a public site: with no tryIt either, the block renders nothing.
tryItProductBarLink—« Try for free » (the first audit is free), the founder offer: absent when the product has none.

Accessibilité

  • A nav named by label, a list of links and menu triggers (Radix NavigationMenu): aria-expanded and aria-controls on each trigger.
  • The mobile panel is a disclosure (no focus trap): its toggle is named by openLabel / closeLabel and says aria-expanded; a press outside closes it. NavBar.MobileGroup is a group named 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 nav named by labels.family; its chevron is a button with the same name, aria-expanded and aria-controls. Each group is a list named by its heading, the current site says aria-current="true" and “You are here”, a site not released says its status in words.
  • NavBar.Repo is an icon link named by label; NavBar.Badge is plain text (DEV · v1.2.3), hidden below sm.

Clavier

TouchesAction
TabMoves between the brand, the items and the actions; leaving an open menu closes it.
Enter / Space / ↓Opens a menu and moves into it.
↑ / ↓ · Home / EndWalks the links of an open menu.
← / →Moves between the items of the bar.
EscCloses the menu, the family or the mobile panel and returns the focus to its trigger.
Click outsideCloses the open menu or the mobile panel.
Enter / Space / ↓ (family)Opens the family from its chevron; ↑ / ↓ walk the sites. It never opens on hover.

Bonnes pratiques

  • The company's bar: <NavBar.Brand href=… org={org} /> with org of @krizaka/org is 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's signupOpen setting), « 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/me answers 200 { signedIn, signupOpen, account? } with Cache-Control: private, no-store and Vary: Cookie (import { meResponse } from "@krizaka/ui/nav-bar/me" in a route handler or server module), signed out is never a 401. NavBar.Session (in NavBar.Actions, needs a @krizaka/query provider) asks it and shows your ProductBarActions or 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 passes initial (its server-read session) so the first paint is the answer; A static page needs no prop: the proxy keeps the readable kz-session=1 flag next to the HttpOnly cookie (sessionHint of @krizaka/auth, which also answers 307 from the landing route to the home with landingRedirect), NavBar.Session reads it (or sessionHint from a dynamic page) and reserves a signed-in placeholder while /api/me answers, so a signed-in person never sees « Sign in » first; the flag is a hint, never an authorization. useNavSession is 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 with NavBar.MobileGroup, in the same order.
  • A menu of three links or fewer is not a menu: NavBar.Menu puts them in the bar as plain links (the current one marked, no dropdown) — inlineUpTo, 3 by default, 0 to keep a dropdown. Above three, the dropdown. The phone panel groups them with NavBar.MobileGroup either way.
  • Light one item at most: the group that holds the page (active on its NavBar.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 asChild on NavBar.Link, NavBar.MenuLink and NavBar.MobileLink.
  • One primary action at most in NavBar.Actions (a Button size="sm" shape="pill").
  • Wrap it in a sticky top-3 (floating) or sticky top-0 container to keep it on screen.
  • Three zones on every Krizaka site: who I am (NavBar.Brand + NavBar.Family current="<site>", then NavBar.Badge with the version or DEV · 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. In NavBar.Mobile it renders as a row, inside NavBar.MobilePreferences with 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.Family as the last child of NavBar.Mobile: below md the family is the panel's last group.
  • Pass the family's words translated: labels={familyLabels[locale]} from @krizaka/ui/sites.

Générée depuis le code de @krizaka/ui 5.3.4 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page