Image with cards 02
A heading and actions on a brand band, over three figure cards on a photo.
Last updated
---
/**
* Image with cards 02: A heading and actions on a brand band, over three figure cards on a photo.
*
* @block metrics
* @order 4
*/
import { CirclePlay } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Button from '@/components/apogee/Button/Button.astro'
import Image from '@/components/apogee/Image/Image.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 {
eyebrow = 'Launch faster',
heading = 'Build something great',
description = 'Everything you need to build modern interfaces and great products.',
primaryAction = { label: 'Get started', href: '#' },
secondaryAction = { label: 'Demo', href: '#' },
items = [
{ value: '400+', label: 'Projects completed', description: "We've helped build over 400 projects with teams of every size." },
{ value: '600%', label: 'Return on investment', description: "Customers report an average return of about 600%." },
{ value: '10k', label: 'Global downloads', description: "Our starter kit has been downloaded over 10k times." },
],
media = { src: 'https://picsum.photos/seed/apogee-metrics-2/1600/900', alt: '', width: 1600, height: 900 },
} = Astro.props
---
<Section spacing="none" container={false}>
<div class="bg-primary pt-section-lg pb-28 text-on-primary md:pb-40">
<div class="mx-auto flex max-w-7xl flex-col items-center gap-8 px-gutter md:gap-12">
<SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" align="center" background="primary" />
{(primaryAction || secondaryAction) && (
<div class="flex w-full flex-col gap-3 sm:w-auto sm:flex-row-reverse">
{primaryAction && <Button href={primaryAction.href} size="large" color="neutral">{primaryAction.label}</Button>}
{secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral" class="border-current! bg-transparent! text-inherit! shadow-none!"><CirclePlay slot="start" aria-hidden="true" />{secondaryAction.label}</Button>}
</div>
)}
</div>
</div>
<div class="mx-auto -mt-16 max-w-7xl px-gutter pb-section-lg md:-mt-24">
<div class="relative isolate overflow-hidden rounded-2xl px-6 py-8 md:p-16">
{media && <div class="absolute inset-0 -z-10"><Image src={media.src} alt={media.alt} width={media.width} height={media.height} fit="cover" class="size-full" /></div>}
<dl class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
{items.map((s) => (
<div class="rounded-2xl bg-page/85 p-6 shadow-raised ring-1 ring-inset ring-neutral backdrop-blur-lg">
<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 text-primary">{s.value}</dd>
{s.description && <dd class="order-3 text-neutral-faded">{s.description}</dd>}
</div>
</div>
))}
</dl>
</div>
</div>
</Section>
Show codeHide code
---
/**
* Image with cards 02: A heading and actions on a brand band, over three figure cards on a photo.
*
* @block metrics
* @order 4
*/
import { CirclePlay } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Button from '@/components/apogee/Button/Button.astro'
import Image from '@/components/apogee/Image/Image.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 {
eyebrow = 'Launch faster',
heading = 'Build something great',
description = 'Everything you need to build modern interfaces and great products.',
primaryAction = { label: 'Get started', href: '#' },
secondaryAction = { label: 'Demo', href: '#' },
items = [
{ value: '400+', label: 'Projects completed', description: "We've helped build over 400 projects with teams of every size." },
{ value: '600%', label: 'Return on investment', description: "Customers report an average return of about 600%." },
{ value: '10k', label: 'Global downloads', description: "Our starter kit has been downloaded over 10k times." },
],
media = { src: 'https://picsum.photos/seed/apogee-metrics-2/1600/900', alt: '', width: 1600, height: 900 },
} = Astro.props
---
<Section spacing="none" container={false}>
<div class="bg-primary pt-section-lg pb-28 text-on-primary md:pb-40">
<div class="mx-auto flex max-w-7xl flex-col items-center gap-8 px-gutter md:gap-12">
<SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" align="center" background="primary" />
{(primaryAction || secondaryAction) && (
<div class="flex w-full flex-col gap-3 sm:w-auto sm:flex-row-reverse">
{primaryAction && <Button href={primaryAction.href} size="large" color="neutral">{primaryAction.label}</Button>}
{secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral" class="border-current! bg-transparent! text-inherit! shadow-none!"><CirclePlay slot="start" aria-hidden="true" />{secondaryAction.label}</Button>}
</div>
)}
</div>
</div>
<div class="mx-auto -mt-16 max-w-7xl px-gutter pb-section-lg md:-mt-24">
<div class="relative isolate overflow-hidden rounded-2xl px-6 py-8 md:p-16">
{media && <div class="absolute inset-0 -z-10"><Image src={media.src} alt={media.alt} width={media.width} height={media.height} fit="cover" class="size-full" /></div>}
<dl class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
{items.map((s) => (
<div class="rounded-2xl bg-page/85 p-6 shadow-raised ring-1 ring-inset ring-neutral backdrop-blur-lg">
<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 text-primary">{s.value}</dd>
{s.description && <dd class="order-3 text-neutral-faded">{s.description}</dd>}
</div>
</div>
))}
</dl>
</div>
</div>
</Section>Add
npx @ava-ui/apogee add metrics/image-with-cards-02
This copies the block to src/components/apogee/blocks/metrics/ with everything it uses: Button, Image, 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
h2by default, so the block slots into a page under itsh1; item titles are one level down. - Photos that only decorate have an empty
alt; give yours one when it carries meaning.
Related
SectionHeaderEyebrow, heading and description at the top of a section or an app page, with actions, a divider and the level, alignment and colours every section shares.
Featured iconAn icon in a tinted tile, the glyph that leads an empty state, an alert, a stat or a feature card.
StatsHeadline numbers in a row or as cards.