A centred heading over three figures split by dividers, on the brand colour.

Last updated

Open block
Show code
---
/**
 * Simple centered text brand: A centred heading over three figures split by dividers, on the brand colour.
 *
 * @block metrics
 * @order 10
 */
import { Zap } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import FeaturedIcon from '@/components/apogee/FeaturedIcon/FeaturedIcon.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" background="primary">
  <div class="flex flex-col gap-12 md:gap-16">
    <div class="flex flex-col items-center gap-4 md:gap-6">
      <FeaturedIcon theme="solid" color="neutral" size="xlarge"><Zap /></FeaturedIcon>
      <SectionHeader heading={plain(heading)} description={description ?? undefined} size="large" align="center" background="primary" />
    </div>
    <dl class="mx-auto flex w-full max-w-3xl flex-col gap-8 md:flex-row md:gap-0 [&>*]:flex-1 md:[&>*+*]:border-s md:[&>*+*]:border-current/25">
      {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/simple-centered-text-brand

This copies the block to src/components/apogee/blocks/metrics/ with everything it uses: FeaturedIcon, 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.