Simple with actions 01
A heading with actions beside it, over four figures with a line each.
Last updated
---
/**
* Simple with actions 01: A heading with actions beside it, over four figures with a line each.
*
* @block metrics
* @order 11
*/
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 { 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.',
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." },
{ value: '200+', label: 'Five-star reviews', description: "We're proud of a five-star rating across 200+ reviews." },
],
} = Astro.props
---
<Section spacing="large">
<div class="flex flex-col gap-12 md:gap-16">
<SectionHeader heading={plain(heading)} description={description ?? undefined} size="large">
{(primaryAction || secondaryAction) && (
<Fragment slot="actions">
{secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral"><CirclePlay slot="start" aria-hidden="true" />{secondaryAction.label}</Button>}
{primaryAction && <Button href={primaryAction.href} size="large">{primaryAction.label}</Button>}
</Fragment>
)}
</SectionHeader>
<dl class="grid gap-8 sm:grid-cols-2 lg:grid-cols-4">
{items.map((s) => (
<div class="flex flex-col gap-3">
<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>
))}
</dl>
</div>
</Section>
Show codeHide code
---
/**
* Simple with actions 01: A heading with actions beside it, over four figures with a line each.
*
* @block metrics
* @order 11
*/
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 { 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.',
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." },
{ value: '200+', label: 'Five-star reviews', description: "We're proud of a five-star rating across 200+ reviews." },
],
} = Astro.props
---
<Section spacing="large">
<div class="flex flex-col gap-12 md:gap-16">
<SectionHeader heading={plain(heading)} description={description ?? undefined} size="large">
{(primaryAction || secondaryAction) && (
<Fragment slot="actions">
{secondaryAction && <Button href={secondaryAction.href} size="large" variant="outline" color="neutral"><CirclePlay slot="start" aria-hidden="true" />{secondaryAction.label}</Button>}
{primaryAction && <Button href={primaryAction.href} size="large">{primaryAction.label}</Button>}
</Fragment>
)}
</SectionHeader>
<dl class="grid gap-8 sm:grid-cols-2 lg:grid-cols-4">
{items.map((s) => (
<div class="flex flex-col gap-3">
<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>
))}
</dl>
</div>
</Section>Add
npx @ava-ui/apogee add metrics/simple-with-actions-01
This copies the block to src/components/apogee/blocks/metrics/ with everything it uses: Button, 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.
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.