Zoeken...  ⌘K GitHub

HeadingAnimated heading

Koptitel met subtiele inloop-animatie.

/heading-animated
src/components/heading/HeadingAnimated.astro
---
interface Props {
  eyebrow?: string;
  title: string;
  sub?: string;
}
const { eyebrow = "Aanpak", title = "Van idee naar resultaat", sub = "Onze bewezen aanpak zorgt voor consistente groei." } = Astro.props;
---

<div class="hd-anim">
  {eyebrow && <span class="hd-anim__eyebrow">{eyebrow}</span>}
  <h2 class="hd-anim__title">{title}</h2>
  {sub && <p class="hd-anim__sub">{sub}</p>}
</div>

<style>
  :root {
    --color-accent: #6366f1;
    --color-primary: #0a0a0a;
  }
  .hd-anim {
    padding: 2.5rem 0;
  }
  .hd-anim__eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
  }
  .hd-anim__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--color-primary);
    display: inline-block;
    position: relative;
    cursor: default;
  }
  .hd-anim__title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 3px;
    background: var(--color-accent);
    transition: width 0.35s ease;
  }
  .hd-anim__title:hover::after {
    width: 100%;
  }
  .hd-anim__sub {
    margin: 0;
    font-size: 1.05rem;
    color: #555;
    line-height: 1.6;
    max-width: 520px;
  }
</style>

Props

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

* = verplicht