Navbar

Glass app chrome — brand, nav links, and optional actions. Default full-bleed bar or island pill; collapses behind a toggle on small screens.

Preview

Live

Caustica Design

Narrow the viewport to exercise the toggle (aria-expanded / aria-controls.

Variants

Default

Static glass bar — see Preview.

Caustica Design

Sticky

.ui-navbar--sticky / React sticky — sticks to the top of the viewport.

Sticky

Open collapse

.is-open / data-open on root and collapse; toggle sets aria-expanded.

Use React open / defaultOpen for controlled or initial state.

With actions

Trailing slot via .ui-navbar__actions / NavbarActions.

App

Island

.ui-navbar--island / React variant="island" — same glass recipe as default Navbar, cropped to a centered pill. Mid-page demos use .ui-navbar--embed so the pill stays in-flow (page chrome omits embed for the fixed mobile menu).

Caustica Design

Accessibility

  • Root is a <header>. Pair with Nav for the primary landmark and give it an aria-label.
  • Toggle is a real button with aria-expanded, aria-controls pointing at the collapse id, and a host-owned aria-label (React label).
  • Decorative hamburger bars use aria-hidden="true".
  • Escape closes an open menu in HTML demos; React wires expand via NavbarToggle. Opt-in dismiss: closeOnOutsideClick / closeOnSwipe (React) or data-close-on-outside-click / data-close-on-swipe (HTML).
  • Island mobile menu is position: fixed under the pill and stacks Nav links vertically so they fit narrow viewports. Set --navbar-island-menu-top from the inner bar’s bottom when open (React does this for variant="island"; HTML hosts should mirror that on resize/scroll). Crossing min-width: 64rem (1024px) closes the menu so aria-expanded stays accurate while the toggle is hidden.
  • Brand mark images that are decorative should use empty alt.

API

HTML classes

Class Description
.ui-navbar Root glass chrome bar.
.ui-navbar--sticky Sticky to the top of the viewport.
.ui-navbar--island Pill crop of the same glass tokens as default Navbar.
.ui-navbar--embed Mid-page / docs showcase — island stays an in-flow pill (no viewport-fixed mobile menu).
.ui-navbar__inner Flex row for brand, toggle, collapse.
.ui-navbar__brand Logo / product name slot.
.ui-navbar__toggle Mobile menu button (bars inside).
.ui-navbar__collapse Collapsible region for nav + actions.
.ui-navbar__actions Trailing actions slot.
.is-open Expanded collapse state on root and collapse.

React props

From src/core/Navbar.tsx — compound Navbar / NavbarBrand / NavbarToggle / NavbarCollapse / NavbarActions. Compose with Nav inside the collapse.

Prop Type Default Description
sticky boolean false Applies .ui-navbar--sticky.
variant 'default' | 'island' 'default' island applies .ui-navbar--island (layout only; same glass tokens).
embed boolean false Applies .ui-navbar--embed — in-flow island for mid-page demos.
open / defaultOpen boolean false Controlled or uncontrolled collapse open state.
onOpenChange (open: boolean) => void Fires when the collapse toggles.
closeOnOutsideClick boolean false When open, pointer down outside the navbar closes the menu. HTML: data-close-on-outside-click.
closeOnSwipe boolean false When open, a vertical swipe on the collapse (≥56px) closes the menu. HTML: data-close-on-swipe.
NavbarToggle label string Required accessible name for the menu button.