Zoeken...  ⌘K GitHub

HeadingUnderline heading

Koptitel met geanimeerde onderstreping.

/heading-underline
src/components/heading/HeadingUnderline.astro
---
interface Props {
  eyebrow?: string;
  title: string;
  sub?: string;
}
const { eyebrow = "Portfolio", title = "Ons werk", sub = "Een selectie van projecten waar we trots op zijn." } = Astro.props;
---

<div class="hd-underline">
  {eyebrow && <span class="hd-underline__eyebrow">{eyebrow}</span>}
  <h2 class="hd-underline__title">
    {title}
    <span class="hd-underline__bar" aria-hidden="true"></span>
  </h2>
  {sub && <p class="hd-underline__sub">{sub}</p>}
</div>

<style>
  :root {
    --color-accent: #6366f1;
    --color-primary: #0a0a0a;
  }
  .hd-underline {
    padding: 2.5rem 0;
    text-align: center;
  }
  .hd-underline__eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
  }
  .hd-underline__title {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }
  .hd-underline__bar {
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-accent), #a855f7);
    border-radius: 2px;
  }
  .hd-underline__sub {
    margin: 0.75rem auto 0;
    max-width: 480px;
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
  }
</style>

Props

Prop Type Default Beschrijving
eyebrow string Klein label boven de titel
title * string Hoofdtitel met onderstreping
sub string Subtekst

* = verplicht