# Build a Liquid Glass Navbar in React

A Liquid Glass navbar is easiest to read when the optical effects live on the shell and the links keep a stable surface behind the text. This example uses the React wrapper from **QuickLiquid 0.2.0** with a thin material and a visible but restrained rim.

[Open the editable navbar in StackBlitz](https://stackblitz.com/github/amarnath3003/quickLiquid/tree/master/examples/react-navbar?file=src%2FNavbar.tsx) and change `refractionStrength` in `src/Navbar.tsx` to see the effect on the striped background.

## Run the example in a fresh project

```sh
npm create vite@latest quickliquid-navbar -- --template react-ts
cd quickliquid-navbar
npm install
npm install quick-liquid@0.2.0
```

Create `src/Navbar.tsx` using the component below. The same component powers the demo on this page. The three URLs are QuickLiquid's navigation destinations. Change them to the routes in your app before shipping.

```tsx
import { LiquidGlass } from 'quick-liquid/react';
import './navbar.css';

const links = [
  { href: 'https://quickliquid.vercel.app/#components', label: 'Components' },
  { href: 'https://quickliquid.vercel.app/playground/', label: 'Playground' },
  { href: 'https://quickliquid.vercel.app/docs/', label: 'Docs' },
];

export function Navbar({ refractionStrength = 20 }: { refractionStrength?: number } = {}) {
  return (
    <LiquidGlass
      className="ql-navbar"
      config={{
        material: 'thin',
        appearance: 'dark',
        borderRadius: 22,
        bezelWidth: 18,
        refractionStrength,
        chromaticAberration: 0.16,
        refractionMode: 'auto',
      }}
    >
      <nav aria-label="Example navigation">
        {links.map(({ href, label }) => <a href={href} key={href}>{label}</a>)}
      </nav>
    </LiquidGlass>
  );
}
```

Save these styles as `src/navbar.css`. The focus outline stays visible over the background, and the links can wrap when the viewport narrows.

```css
.ql-navbar {
  width: fit-content;
  max-width: 100%;
  border-radius: 22px;
  color: #fff;
}

.ql-navbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.4rem;
}

.ql-navbar a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.85rem;
  border-radius: 0.85rem;
  background: rgb(12 16 30 / 68%);
  color: #fff;
  text-decoration: none;
}

.ql-navbar a:hover,
.ql-navbar a:focus-visible {
  background: #202643;
}

.ql-navbar a:focus-visible {
  outline: 2px solid #c5e8ff;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .ql-navbar nav {
    gap: 0.2rem;
    padding: 0.3rem;
  }

  .ql-navbar a {
    padding-inline: 0.53rem;
    font-size: 0.87rem;
  }
}
```

Replace `src/App.tsx` with a scene that puts high-contrast detail behind the glass.

```tsx
import { Navbar } from './Navbar';

export default function App() {
  return (
    <main style={{
      display: 'grid', placeItems: 'center', minHeight: '75vh',
      background: 'repeating-linear-gradient(125deg, #213369 0 44px, #a9c7ff 44px 49px)',
    }}>
      <Navbar />
    </main>
  );
}
```

Run `npm run dev` and open the local URL. The stripes give you a clear reference for checking the shape of the rim. You can also save the exact [component source](/blog/examples/react-navbar/Navbar.tsx) and [stylesheet](/blog/examples/react-navbar/navbar.css).

## Tune it for your page

Start with `refractionStrength` around `20` and lower it when the backdrop is busy. `bezelWidth` controls the width of the optical rim and `borderRadius` should agree with the CSS shape. In `auto` mode the library selects the supported path, so expect a frosted treatment where live SVG backdrop refraction is unavailable. To test that appearance in Chromium, set `refractionMode` to `css`.

Tab through the links before calling the example finished. Check it over a bright area, a dark area, and at a phone width. The materials and source scenes in the [playground](/playground/) are a fast way to find a configuration that fits your design.
