Code

<!-- glass-nav.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-nav.free.js" defer></script>

<glass-nav brand="Meridian" width="640" size="56" sticky theme="light">
  <a href="/product" aria-current="page">Product</a>
  <a href="/pricing">Pricing</a>
  <a href="/docs">Docs</a>
  <a href="/customers" data-menu data-group="Company" data-desc="1,240 teams and counting">Customers</a>
  <a href="/careers" data-menu data-group="Company" data-desc="Six open roles">Careers</a>
  <a href="/signup" data-cta>Get started</a>
</glass-nav>

<script>
  document.querySelector('glass-nav').addEventListener('toggle', (e) => {
    console.log(e.detail.open);
  });
</script>

In context

In a narrow column the links move into the menu
Sunset, no button Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/glass-nav.json
2. Load it and use the element
HTML
<!-- glass-nav.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-nav.free.js" defer></script>

<glass-nav brand="Meridian" width="760" size="56" sticky theme="light">
  <a href="/product" aria-current="page">Product</a>
  <a href="/pricing">Pricing</a>
  <a href="/docs">Docs</a>
  <a href="/customers" data-menu data-group="Company" data-desc="1,240 teams and counting">Customers</a>
  <a href="/careers" data-menu data-group="Company" data-desc="Six open roles">Careers</a>
  <a href="/signup" data-cta>Get started</a>
</glass-nav>

<script>
  document.querySelector('glass-nav').addEventListener('toggle', (e) => {
    console.log(e.detail.open);
  });
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// glass-nav.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'glass-nav': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      brand?: string;
      open?: boolean | '';
      width?: number | string;
      size?: number | string;
      sticky?: boolean | '';
      theme?: 'light' | 'dark';
      sound?: boolean | '';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component (links, brand, cta, open / onOpenChange, onNavigate) with TypeScript types and the full source
  • Sunset, Mint and Mono tints, plus custom tints from Brand Fit
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
<a href> children—The links. A plain link sits in the bar (and in the menu when the bar is narrow); aria-current="page" marks the current page; data-label overrides its text.
data-menu attribute on a link—Menu only: the link never shows in the bar. With data-group="Company" it sits under that heading, and data-desc adds a quieter second line.
data-cta attribute on a link—The one filled button on the right. In a narrow bar it moves to the bottom of the menu.
brand string—Name on the left. For a logo or a home link, add a child with data-brand instead (an <a>, an <img>, anything).
open booleanoffThe menu is open. Also el.show(), el.hide() and el.toggle(). Fires toggle with detail.open when the user opens or closes it.
width number (px) | CSS width760Max width of the capsule; it is centred and never wider than its parent. Below 560px of real width the bar links hide and only the menu remains.
size number (px)56Bar height; the type, the pill and the buttons scale with it.
sticky booleanoffposition: sticky at the top of the scroller (offset --gn-top, 12px). Without it the header stays in the normal flow.
theme 'light' | 'dark''light'White or dark glass.
sound booleanoffA glass clink as the menu opens and closes. Also on for everything inside an element with data-ui-sound="on".
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the light along the top edge and the current-page mark, or a custom tint. Free build ships Aurora only.

The header takes one bar of height in the layout; the open menu grows over whatever is below it, so nothing on the page jumps. The menu button carries aria-expanded and aria-controls; the closed menu is inert. Opened from the keyboard, focus steps into the menu, the arrows, Home and End walk it, and Escape, Tab-ing away or a click outside closes it and hands focus back. Clicking a link fires a cancelable navigate event with detail.href and detail.label — call preventDefault() to route it yourself. The compact layout is measured on the element, not the viewport, so it also collapses inside a sidebar or a preview frame. The links are read once, when the element connects. All CSS, no WebGL; the backdrop blur is the only costly part.

More components