Navbars JS behaviour

Glass navbar

Real glass over a colourful hero: 14px of blur with high saturation and a one-pixel light-catching rim; links grow a glass pill on hover while the far side carries the day/night mood button and a gradient-ringed avatar.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Glass that proves itself by what shines through

Blurring 14px at 140% saturation over a hero that keeps moving — links grow glass pills on hover, and the mood button flips day to night while the avatar holds its gradient ring.

Day glass, night glass

The same bar over both hero palettes — hover the links and press the mood button; the pills stay glass either way.

mood = day
mood = night

Important props

Important props
Prop Type Default What it does
blur length '14px' The backdrop-filter strength; everything under the bar shows through soft and glassy.
saturate percent '140%' Colours saturate through the glass — what real glass does with light.
light-rim shadow 'inset 0 1px 0' The one-pixel light-catching rim on the bar’s top edge and the hover pills; it draws the glass edge.
hover-pill state 'on hover · focus' Each link grows its own glass pill on hover and focus — fully rounded, borderless.
mood string 'day' The mood button flips the stage hero between day and night, and the glass follows it.

Snippet

{{-- resources/views/components/glass-navbar.blade.php — glass over the hero --}}
<div class="gln" x-data="{ mood: 'day' }">
    <section class="gln-stage" x-bind:data-mood="mood">
        <header class="gln-bar">
            <b class="gln-brand"><i aria-hidden="true"></i>Meridian</b>
            <nav aria-label="Primary">
                <a href="#product" aria-current="page">Product</a>
                <a href="#pricing">Pricing</a>
                <a href="#docs">Docs</a>
            </nav>
            <span class="gln-end">
                <button type="button" class="gln-mood" x-bind:aria-label="mood === 'day' ? 'Night mood' : 'Day mood'"
                        x-on:click="mood = mood === 'day' ? 'night' : 'day'">
                    <span x-show="mood === 'day'">☾</span>
                    <span x-show="mood === 'night'" x-cloak>☀</span>
                </button>
                <span class="gln-ava" aria-label="Lena Kovacs">LK</span>
            </span>
        </header>
        <div class="gln-hero">
            <h2>Latency you can feel, dashboards you can read</h2>
            <p>Frankfurt to Singapore, in one glance.</p>
        </div>
    </section>
</div>

<style>
.gln-stage { position: relative; min-block-size: 26rem; overflow: clip; border-radius: 1rem;
             background: linear-gradient(140deg, #22d3ee, #818cf8 55%, #f472b6); }
.gln-bar { position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 5;
           display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.5rem; color: #fff;
           background: rgba(255, 255, 255, .12); border-block-end: 1px solid rgba(255, 255, 255, .18);
           backdrop-filter: blur(14px) saturate(140%);
           box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.gln-stage[data-mood='night'] { background: linear-gradient(140deg, #0f172a, #3730a3 60%, #7e22ce); }
.gln-bar nav { display: flex; gap: .25rem; }
.gln-bar nav a { padding: .5rem .9rem; border-radius: 999px; color: #fff; text-decoration: none;
                 transition: background-color .18s, box-shadow .18s; }
.gln-bar nav a:hover, .gln-bar nav a:focus-visible { background: rgba(255, 255, 255, .16);
                 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.gln-ava { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1; border-radius: 50%;
           background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); font-size: .72rem; }
</style>
// app/Pages/Landing.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import GlassNavbar from '@/components/GlassNavbar';

export default function Landing() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <GlassNavbar />
    </NabuXUIProvider>
  );
}
// GlassNavbar.jsx — blur + saturate + light rim over a colourful hero
import { useState } from 'react';
import '@nabuxai/ui-core/css';

const LINKS = ['Product', 'Pricing', 'Docs'];

export default function GlassNavbar() {
  const [mood, setMood] = useState('day');
  const night = mood === 'night';

  return (
    <>
      <style>{`
        .gln-stage { position: relative; min-block-size: 26rem; overflow: clip; border-radius: 1rem;
                     background: linear-gradient(140deg, #22d3ee, #818cf8 55%, #f472b6);
                     font: 500 14px/1 Inter, sans-serif; color: #fff; }
        .gln-stage[data-mood='night'] { background: linear-gradient(140deg, #0f172a, #3730a3 60%, #7e22ce); }
        .gln-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .5;
                   pointer-events: none; }
        .gln-bar { position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 5;
                   display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.5rem;
                   background: rgba(255, 255, 255, .12); border-block-end: 1px solid rgba(255, 255, 255, .18);
                   backdrop-filter: blur(14px) saturate(140%);
                   box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
        .gln-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; }
        .gln-brand i { inline-size: 1.15rem; aspect-ratio: 1; border-radius: .35rem;
                       background: rgba(255, 255, 255, .3); }
        .gln-bar nav { display: flex; gap: .25rem; }
        .gln-bar nav a { padding: .5rem .9rem; border-radius: 999px; color: #fff; text-decoration: none;
                         transition: background-color .18s, box-shadow .18s; }
        .gln-bar nav a:hover, .gln-bar nav a:focus-visible { background: rgba(255, 255, 255, .16);
                         box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
        .gln-bar nav a[aria-current='page'] { background: rgba(255, 255, 255, .16); font-weight: 600; }
        .gln-end { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .75rem; }
        .gln-mood { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1;
                    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff;
                    cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
        .gln-ava { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1; border-radius: 50%;
                   background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
                   font-size: .72rem; }
        .gln-hero { position: relative; z-index: 1; padding: 11rem 1.5rem 2.5rem; text-align: center; }
      `}</style>
      <section className="gln-stage" data-mood={mood}>
        <span className="gln-orb" style={{ insetBlockStart: '5rem', insetInlineStart: '12%', inlineSize: '7rem', aspectRatio: 1, background: 'rgba(255,255,255,.35)' }} />
        <span className="gln-orb" style={{ insetBlockEnd: '3rem', insetInlineEnd: '10%', inlineSize: '5rem', aspectRatio: 1, background: 'rgba(255,255,255,.25)' }} />
        <header className="gln-bar">
          <b className="gln-brand"><i aria-hidden="true"></i>Meridian</b>
          <nav aria-label="Primary">
            {LINKS.map((l, i) => (
              <a key={l} href={`#${l.toLowerCase()}`} aria-current={i === 0 ? 'page' : null}>{l}</a>
            ))}
          </nav>
          <span className="gln-end">
            <button type="button" className="gln-mood" aria-label={night ? 'Day mood' : 'Night mood'}
                    onClick={() => setMood(night ? 'day' : 'night')}>
              {night ? '☀' : '☾'}
            </button>
            <span className="gln-ava" aria-label="Lena Kovacs">LK</span>
          </span>
        </header>
        <div className="gln-hero">
          <h2>Latency you can feel, dashboards you can read</h2>
          <p>Frankfurt to Singapore, in one glance.</p>
        </div>
      </section>
    </>
  );
}
<!-- GlassNavbar.vue — blur + saturate + light rim over a colourful hero -->
<script setup lang="ts">
import { ref } from 'vue';
import '@nabuxai/ui-core/css';

const LINKS = ['Product', 'Pricing', 'Docs'];
const mood = ref<'day' | 'night'>('day');
</script>

<template>
  <section class="gln-stage" :data-mood="mood">
    <header class="gln-bar">
      <b class="gln-brand"><i aria-hidden="true"></i>Meridian</b>
      <nav aria-label="Primary">
        <a v-for="(l, i) in LINKS" :key="l" :href="'#' + l.toLowerCase()"
           :aria-current="i === 0 ? 'page' : null">{{ l }}</a>
      </nav>
      <span class="gln-end">
        <button type="button" class="gln-mood"
                :aria-label="mood === 'day' ? 'Night mood' : 'Day mood'"
                @click="mood = mood === 'day' ? 'night' : 'day'">
          {{ mood === 'night' ? '☀' : '☾' }}
        </button>
        <span class="gln-ava" aria-label="Lena Kovacs">LK</span>
      </span>
    </header>
    <div class="gln-hero">
      <h2>Latency you can feel, dashboards you can read</h2>
      <p>Frankfurt to Singapore, in one glance.</p>
    </div>
  </section>
</template>

<style scoped>
.gln-stage { position: relative; min-block-size: 26rem; overflow: clip; border-radius: 1rem;
             background: linear-gradient(140deg, #22d3ee, #818cf8 55%, #f472b6);
             font: 500 14px/1 Inter, sans-serif; color: #fff; }
.gln-stage[data-mood='night'] { background: linear-gradient(140deg, #0f172a, #3730a3 60%, #7e22ce); }
.gln-bar { position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 5;
           display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.5rem;
           background: rgba(255, 255, 255, .12); border-block-end: 1px solid rgba(255, 255, 255, .18);
           backdrop-filter: blur(14px) saturate(140%);
           box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.gln-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; }
.gln-brand i { inline-size: 1.15rem; aspect-ratio: 1; border-radius: .35rem;
               background: rgba(255, 255, 255, .3); }
.gln-bar nav { display: flex; gap: .25rem; }
.gln-bar nav a { padding: .5rem .9rem; border-radius: 999px; color: #fff; text-decoration: none;
                 transition: background-color .18s, box-shadow .18s; }
.gln-bar nav a:hover, .gln-bar nav a:focus-visible { background: rgba(255, 255, 255, .16);
                 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.gln-bar nav a[aria-current='page'] { background: rgba(255, 255, 255, .16); font-weight: 600; }
.gln-end { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .75rem; }
.gln-mood { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1;
            border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff;
            cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.gln-ava { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1; border-radius: 50%;
           background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
           font-size: .72rem; }
.gln-hero { position: relative; z-index: 1; padding: 11rem 1.5rem 2.5rem; text-align: center; }
</style>
<!-- GlassNavbar.svelte — blur + saturate + light rim over a colourful hero -->
<script lang="ts">
  import '@nabuxai/ui-core/css';

  const LINKS = ['Product', 'Pricing', 'Docs'];
  let mood = $state<'day' | 'night'>('day');
</script>

<section class="gln-stage" data-mood={mood}>
  <header class="gln-bar">
    <b class="gln-brand"><i aria-hidden="true"></i>Meridian</b>
    <nav aria-label="Primary">
      {#each LINKS as l, i (l)}
        <a href={'#' + l.toLowerCase()} aria-current={i === 0 ? 'page' : null}>{l}</a>
      {/each}
    </nav>
    <span class="gln-end">
      <button type="button" class="gln-mood"
              aria-label={mood === 'day' ? 'Night mood' : 'Day mood'}
              onclick={() => (mood = mood === 'day' ? 'night' : 'day')}>
        {mood === 'night' ? '☀' : '☾'}
      </button>
      <span class="gln-ava" aria-label="Lena Kovacs">LK</span>
    </span>
  </header>
  <div class="gln-hero">
    <h2>Latency you can feel, dashboards you can read</h2>
    <p>Frankfurt to Singapore, in one glance.</p>
  </div>
</section>

<style>
.gln-stage { position: relative; min-block-size: 26rem; overflow: clip; border-radius: 1rem;
             background: linear-gradient(140deg, #22d3ee, #818cf8 55%, #f472b6);
             font: 500 14px/1 Inter, sans-serif; color: #fff; }
.gln-stage[data-mood='night'] { background: linear-gradient(140deg, #0f172a, #3730a3 60%, #7e22ce); }
.gln-bar { position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 5;
           display: flex; align-items: center; gap: 1.25rem; padding: 1rem 1.5rem;
           background: rgba(255, 255, 255, .12); border-block-end: 1px solid rgba(255, 255, 255, .18);
           backdrop-filter: blur(14px) saturate(140%);
           box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.gln-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; }
.gln-brand i { inline-size: 1.15rem; aspect-ratio: 1; border-radius: .35rem;
               background: rgba(255, 255, 255, .3); }
.gln-bar nav { display: flex; gap: .25rem; }
.gln-bar nav a { padding: .5rem .9rem; border-radius: 999px; color: #fff; text-decoration: none;
                 transition: background-color .18s, box-shadow .18s; }
.gln-bar nav a:hover, .gln-bar nav a:focus-visible { background: rgba(255, 255, 255, .16);
                 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.gln-bar nav a[aria-current='page'] { background: rgba(255, 255, 255, .16); font-weight: 600; }
.gln-end { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .75rem; }
.gln-mood { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1;
            border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff;
            cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.gln-ava { display: grid; place-items: center; inline-size: 2.2rem; aspect-ratio: 1; border-radius: 50%;
           background: rgba(255, 255, 255, .18); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
           font-size: .72rem; }
.gln-hero { position: relative; z-index: 1; padding: 11rem 1.5rem 2.5rem; text-align: center; }
</style>