Zoeken...  ⌘K GitHub

NavUnderline Navigation

Actieve link gemarkeerd met kleurrijke underline. Geen boxen.

/nav-underline
src/components/nav/NavUnderline.astro
---
/**
 * NavUnderline
 * Actieve link gemarkeerd met een kleurrijke underline. Geen boxen.
 */
interface Props {
  logo: string;
  links: { label: string; href: string; active?: boolean }[];
  cta?: { label: string; href: string };
}
const { logo, links, cta } = Astro.props;
---
<header class="nu">
  <nav class="nu-inner">
    <a href="/" class="nu-logo">{logo}</a>
    <ul class="nu-links">
      {links.map(l => (
        <li><a href={l.href} class={`nu-link${l.active ? ' nu-link--active' : ''}`}>{l.label}</a></li>
      ))}
    </ul>
    {cta && <a href={cta.href} class="nu-cta">{cta.label}</a>}
  </nav>
</header>
<style>
  .nu { background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 100; }
  .nu-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; height: 64px; gap: 2rem; }
  .nu-logo { font-weight: 800; font-size: 1.0625rem; color: #0a0a0a; text-decoration: none; letter-spacing: -0.02em; }
  .nu-links { list-style: none; padding: 0; margin: 0; display: flex; flex: 1; gap: 0; height: 100%; }
  .nu-link { display: flex; align-items: center; font-size: 0.875rem; font-weight: 500; color: #6b7280; text-decoration: none; padding: 0 0.875rem; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; height: 100%; box-sizing: border-box; }
  .nu-link:hover { color: #0a0a0a; }
  .nu-link--active { color: var(--color-accent,#6366f1); border-bottom-color: var(--color-accent,#6366f1); }
  .nu-cta { margin-left: auto; font-size: 0.875rem; font-weight: 600; padding: 0.5rem 1.25rem; background: var(--color-accent,#6366f1); color: #fff; border-radius: 0.5rem; text-decoration: none; transition: opacity 0.2s; white-space: nowrap; }
  .nu-cta:hover { opacity: 0.88; }
  @media (max-width: 768px) { .nu-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