Meridian
Mira Okafor

Code

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

<glass-sidebar brand="Meridian" width="248" size="40" theme="light">
  <a href="/home" data-icon="home">Home</a>
  <a href="/inbox" data-icon="inbox" data-badge="3" aria-current="page">Inbox</a>
  <a href="/reports" data-icon="chart">Reports</a>
  <div data-label="Projects" data-icon="folder" data-section="Workspace" data-open>
    <a href="/projects/atlas">Atlas</a>
    <a href="/projects/harbor" data-badge="New">Harbor</a>
  </div>
  <a href="/team" data-icon="users">Team</a>
  <a href="/settings" data-icon="settings" data-section="Account">Settings</a>
</glass-sidebar>

<script>
  const sidebar = document.querySelector('glass-sidebar');
  sidebar.addEventListener('change', (e) => console.log(e.detail.value));
  sidebar.addEventListener('toggle', (e) => console.log(e.detail.collapsed));
</script>

In context

Folded to an icon rail — point at an icon
Sunset, compact rows 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-sidebar.json
2. Load it and use the element
HTML
<!-- glass-sidebar.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-sidebar.free.js" defer></script>

<glass-sidebar brand="Meridian" width="248" size="40" theme="light">
  <a href="/home" data-icon="home">Home</a>
  <a href="/inbox" data-icon="inbox" data-badge="3" aria-current="page">Inbox</a>
  <a href="/reports" data-icon="chart">Reports</a>
  <div data-label="Projects" data-icon="folder" data-section="Workspace" data-open>
    <a href="/projects/atlas">Atlas</a>
    <a href="/projects/harbor" data-badge="New">Harbor</a>
  </div>
  <a href="/team" data-icon="users">Team</a>
  <a href="/settings" data-icon="settings" data-section="Account">Settings</a>
</glass-sidebar>

<script>
  const sidebar = document.querySelector('glass-sidebar');
  sidebar.addEventListener('change', (e) => console.log(e.detail.value));
  sidebar.addEventListener('toggle', (e) => console.log(e.detail.collapsed));
</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-sidebar.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'glass-sidebar': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      value?: string;
      collapsed?: boolean | '';
      brand?: string;
      width?: number | string;
      height?: number | string;
      size?: number | string;
      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 (items, value / onChange, collapsed / onCollapsedChange, brand, footer, your own icon nodes) 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 rows. data-icon names a built-in icon (home, inbox, chart, folder, users, settings, file, calendar, card, bell, search, star, layers, help) — or put your own <svg> inside the link; data-badge adds a count; data-section starts a heading that carries on to the rows after it; data-value sets what change reports (default: the href).
<div data-label> children—A group that expands: any element that holds links. data-label is its name, data-icon its icon, data-open starts it expanded. The group that holds the current page opens by itself.
value stringthe aria-current linkThe current row — its data-value or href. It gets aria-current="page". Fires a cancelable change with detail.value and detail.href when the user picks a row.
collapsed booleanoffIcon rail: labels fade, badges become dots, names show as tooltips on hover and focus. Also el.collapse(), el.expand() and el.toggle(). Fires toggle with detail.collapsed.
brand string—Name at the top. For a logo, add a child with data-brand; a child with data-footer sits at the bottom (put the avatar first — it stays visible in the rail).
width number (px) | CSS width248Width when expanded. The rail is 1.4 × the row height plus the padding.
height number (px) | CSS heightautoFixed height (100% for a full-height shell); the list scrolls inside. Without it the sidebar is as tall as its rows.
size number (px)40Row height; the type, the icons, the corners and the rail scale with it.
theme 'light' | 'dark''light'White or dark glass.
sound booleanoffA glass tick on a pick and a clink as the sidebar folds. Also on for everything inside an element with data-ui-sound="on".
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the light on the current row and along the top edge, or a custom tint. Free build ships Aurora only.

A real nav of links: every row is a tab stop, and Up / Down, Home and End also walk the rows; Right opens a group or steps into it, Left closes it or goes back to its parent. The highlight is one element for the whole list — it follows the pointer and keyboard focus and returns to the current page when you leave. In the rail the labels stay in the accessibility tree, so screen readers still read them; a group pressed in the rail brings the sidebar back first. change is cancelable: call preventDefault() to stop the page load and route it yourself — the mark moves either way. The rows are read once, when the element connects. The sidebar is a block with its own width, so put it in a flex row next to your content; it does not overlay the page. All CSS, no WebGL; the backdrop blur is the only costly part.

More components