Zoeken...  ⌘K GitHub

NavFloating Navigation

Floating pill-shaped nav die zweeft boven content. Glassmorphism.

/nav-floating
src/components/nav/NavFloating.astro
---
/**
 * NavFloating
 * Floating pill-shaped nav die zweeft boven content. Glassmorphism + shadow.
 */
interface Props {
  logo: string;
  links: { label: string; href: string; active?: boolean }[];
  cta?: { label: string; href: string };
}
const { logo, links, cta } = Astro.props;
---
<div class="nf-wrapper">
  <header class="nf">
    <a href="/" class="nf-logo">{logo}</a>
    <ul class="nf-links">
      {links.map(l => (
        <li><a href={l.href} class={`nf-link${l.active ? ' nf-link--active' : ''}`}>{l.label}</a></li>
      ))}
    </ul>
    {cta && <a href={cta.href} class="nf-cta">{cta.label}</a>}
  </header>
</div>
<style>
  .nf-wrapper { position: fixed; top: 1.25rem; left: 0; right: 0; z-index: 100; display: flex; justify-content: center; pointer-events: none; }
  .nf { pointer-events: all; display: flex; align-items: center; gap: 0.25rem; padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.85); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid rgba(255,255,255,0.6); border-radius: 999px; box-shadow: 0 4px 24px rgba(0,0,0,0.1); gap: 0; }
  .nf-logo { font-weight: 800; font-size: 0.9375rem; color: #0a0a0a; text-decoration: none; padding: 0.25rem 0.875rem; letter-spacing: -0.02em; }
  .nf-links { list-style: none; padding: 0; margin: 0; display: flex; gap: 0; }
  .nf-link { display: block; font-size: 0.8125rem; font-weight: 500; color: #374151; text-decoration: none; padding: 0.375rem 0.75rem; border-radius: 999px; transition: all 0.15s; }
  .nf-link:hover, .nf-link--active { color: var(--color-accent,#6366f1); background: rgba(99,102,241,0.08); }
  .nf-cta { font-size: 0.8125rem; font-weight: 600; padding: 0.4375rem 1rem; background: var(--color-accent,#6366f1); color: #fff; border-radius: 999px; text-decoration: none; margin-left: 0.25rem; transition: opacity 0.2s; }
  .nf-cta:hover { opacity: 0.88; }
  @media (max-width: 640px) { .nf-links { display: none; } }
</style>

Props

Prop Type Default Beschrijving
logo * string Merknaam
links * { label: string; href: string; active?: boolean }[] Navigatielinks
cta { label: string; href: string } CTA knop

* = verplicht