Zoeken...  ⌘K GitHub

NavPills Navigation

Pill-shaped actieve staat voor links. Modern SaaS-stijl navigatie.

/nav-pills
src/components/nav/NavPills.astro
---
/**
 * NavPills
 * Pill-shaped actieve staat voor navigatielinks. Modern SaaS-stijl.
 */
interface Props {
  logo: string;
  links: { label: string; href: string; active?: boolean }[];
  cta?: { label: string; href: string };
}
const { logo, links, cta } = Astro.props;
---
<header class="np">
  <nav class="np-inner">
    <a href="/" class="np-logo">{logo}</a>
    <ul class="np-links">
      {links.map(l => (
        <li><a href={l.href} class={`np-link${l.active ? ' np-link--active' : ''}`}>{l.label}</a></li>
      ))}
    </ul>
    <div class="np-actions">
      {cta && <a href={cta.href} class="np-cta">{cta.label}</a>}
    </div>
  </nav>
</header>
<style>
  .np { background: #fff; border-bottom: 1px solid #f1f5f9; position: sticky; top: 0; z-index: 100; }
  .np-inner { max-width: 1280px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; height: 64px; gap: 2rem; }
  .np-logo { font-weight: 800; font-size: 1.0625rem; color: #0a0a0a; text-decoration: none; letter-spacing: -0.02em; }
  .np-links { list-style: none; padding: 0; margin: 0; display: flex; flex: 1; gap: 0.25rem; background: #f8fafc; border-radius: 999px; padding: 0.25rem; }
  .np-link { display: block; font-size: 0.8125rem; font-weight: 500; color: #6b7280; text-decoration: none; padding: 0.375rem 0.875rem; border-radius: 999px; transition: all 0.15s; white-space: nowrap; }
  .np-link:hover { color: #374151; background: #fff; }
  .np-link--active { background: #fff; color: #0a0a0a; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
  .np-actions { margin-left: auto; }
  .np-cta { font-size: 0.875rem; font-weight: 600; padding: 0.5rem 1.25rem; background: var(--color-accent,#6366f1); color: #fff; border-radius: 999px; text-decoration: none; transition: opacity 0.2s; }
  .np-cta:hover { opacity: 0.88; }
  @media (max-width: 768px) { .np-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