A centred heading over three figures in a brand-colour card.

Last updated

Open block
Show code
---
/**
 * Card brand dark: A centred heading over three figures in a brand-colour card.
 *
 * @block metrics
 * @order 1
 */
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { MetricsContent } from '@/components/apogee/sections/_shared/metrics.ts'

/** @composable */
interface Props extends MetricsContent {}

const {
  heading = 'Build something great',
  description = 'Everything you need to build modern interfaces and great products.',
  items = [
    { value: '400+', label: 'Projects completed' },
    { value: '600%', label: 'Return on investment' },
    { value: '10k', label: 'Global downloads' },
  ],
} = Astro.props
---

<Section spacing="large">
  <div class="flex flex-col gap-12 md:gap-16">
    <SectionHeader heading={plain(heading)} description={description ?? undefined} size="large" align="center" />
    <dl class="flex flex-col gap-8 rounded-2xl bg-primary px-6 py-10 text-on-primary md:flex-row md:p-16 [&>*]:flex-1">
      {items.map((s) => (
        <div class="flex flex-col gap-3 items-center text-center">
          <dt class="order-2 text-lg font-semibold">{s.label}</dt>
          <dd class="order-1 text-5xl font-semibold tracking-tight tabular-nums md:text-6xl ">{s.value}</dd>
        </div>
      ))}
    </dl>
  </div>
</Section>

Add

npx @ava-ui/apogee add metrics/card-brand-dark

This copies the block to src/components/apogee/blocks/metrics/ with everything it uses: Section, SectionHeader. Every piece of copy is a prop, with the sample copy as its default. Pass yours, or null to hide a part; see copy is props.

Accessibility

  • The heading is an h2 by default, so the block slots into a page under its h1; item titles are one level down.