Primary card icon
A centred heading and billing switch over three tinted plan panels with icons.
Last updated
---
/**
* Primary card icon: A centred heading and billing switch over three tinted plan panels with icons.
*
* @block pricing
* @order 19
*/
import { CircleCheck, Layers2, Layers3, Zap } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Heading from '@/components/apogee/Heading/Heading.astro'
import Button from '@/components/apogee/Button/Button.astro'
import FeaturedIcon from '@/components/apogee/FeaturedIcon/FeaturedIcon.astro'
import SegmentedControl from '@/components/apogee/SegmentedControl/SegmentedControl.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { PricingContent } from '@/components/apogee/sections/_shared/pricing.ts'
/** @composable */
interface Props extends PricingContent {}
const {
eyebrow,
heading = 'Pricing plans',
description = 'Simple, transparent pricing that grows with you. Try any plan free for 30 days.',
periodLabel = 'Billing period',
periods = { monthly: 'Monthly billing', annual: 'Annual billing' },
items = [
{ name: 'Basic plan', price: '$10', annualPrice: '$9', period: 'mth', description: 'Billed annually.', features: ['Access to all basic features', 'Basic reporting and analytics', 'Up to 10 individual users', '20 GB individual data', 'Basic chat and email support'], action: { label: 'Get started', href: '#' } },
{ name: 'Business plan', price: '$20', annualPrice: '$15', period: 'mth', description: 'Billed annually.', features: ['200+ integrations', 'Advanced reporting and analytics', 'Up to 20 individual users', '40 GB individual data', 'Priority chat and email support'], action: { label: 'Get started', href: '#' } },
{ name: 'Enterprise plan', price: '$40', annualPrice: '$39', period: 'mth', description: 'Billed annually.', features: ['Advanced custom fields', 'Audit log and data history', 'Unlimited individual users', 'Unlimited individual data', 'Personalised and priority service'], action: { label: 'Get started', href: '#' } },
],
} = Astro.props
const icons = [Zap, Layers2, Layers3]
---
<Section spacing="large">
<div class="group/pricing flex flex-col gap-12 md:gap-16">
<div class="flex flex-col items-stretch gap-8 sm:items-center md:gap-12">
<SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" align="center" />
<SegmentedControl name="billing" options={[{ label: periods.monthly, value: 'monthly' }, { label: periods.annual, value: 'annual' }]} value="monthly" aria-label={periodLabel} size="large" />
</div>
<div class="grid gap-4 md:grid-cols-2 md:gap-8 xl:grid-cols-3 items-end">
{items.map((plan, i) => {
const Icon = icons[i % icons.length]!
return (
<div class="flex flex-col gap-8 bg-primary-faded px-6 py-8 md:px-8 md:py-10">
<div class="flex flex-col items-center gap-3 text-center">
<FeaturedIcon theme="solid" color="primary" size="large"><Icon /></FeaturedIcon>
<Heading as="h3" size="h5" class="text-primary">{plan.name}</Heading>
<p class="flex items-baseline justify-center gap-1"><span class="text-5xl md:text-6xl font-semibold tracking-tight tabular-nums"><span class="group-has-[[value=annual]:checked]/pricing:hidden">{plan.price}</span><span class="hidden group-has-[[value=annual]:checked]/pricing:inline">{plan.annualPrice ?? plan.price}</span></span>{plan.period && <span class="text-neutral-faded">/{plan.period}</span>}</p>
<p class="text-neutral-faded">{plan.description}</p>
</div>
<ul class="flex list-none flex-col gap-4 p-0 text-neutral-faded flex-1">
{plan.features.map((f) => <li class="flex gap-3"><CircleCheck class="size-6 shrink-0 text-primary" aria-hidden="true" /><span>{f}</span></li>)}
</ul>
<Button href={plan.action.href} size="large" fullWidth>{plan.action.label}</Button>
</div>
)
})}
</div>
</div>
</Section>
Show codeHide code
---
/**
* Primary card icon: A centred heading and billing switch over three tinted plan panels with icons.
*
* @block pricing
* @order 19
*/
import { CircleCheck, Layers2, Layers3, Zap } from '@lucide/astro'
import Section from '@/components/apogee/Section/Section.astro'
import SectionHeader from '@/components/apogee/SectionHeader/SectionHeader.astro'
import Heading from '@/components/apogee/Heading/Heading.astro'
import Button from '@/components/apogee/Button/Button.astro'
import FeaturedIcon from '@/components/apogee/FeaturedIcon/FeaturedIcon.astro'
import SegmentedControl from '@/components/apogee/SegmentedControl/SegmentedControl.astro'
import { plain } from '@/components/apogee/sections/_shared/spine.ts'
import type { PricingContent } from '@/components/apogee/sections/_shared/pricing.ts'
/** @composable */
interface Props extends PricingContent {}
const {
eyebrow,
heading = 'Pricing plans',
description = 'Simple, transparent pricing that grows with you. Try any plan free for 30 days.',
periodLabel = 'Billing period',
periods = { monthly: 'Monthly billing', annual: 'Annual billing' },
items = [
{ name: 'Basic plan', price: '$10', annualPrice: '$9', period: 'mth', description: 'Billed annually.', features: ['Access to all basic features', 'Basic reporting and analytics', 'Up to 10 individual users', '20 GB individual data', 'Basic chat and email support'], action: { label: 'Get started', href: '#' } },
{ name: 'Business plan', price: '$20', annualPrice: '$15', period: 'mth', description: 'Billed annually.', features: ['200+ integrations', 'Advanced reporting and analytics', 'Up to 20 individual users', '40 GB individual data', 'Priority chat and email support'], action: { label: 'Get started', href: '#' } },
{ name: 'Enterprise plan', price: '$40', annualPrice: '$39', period: 'mth', description: 'Billed annually.', features: ['Advanced custom fields', 'Audit log and data history', 'Unlimited individual users', 'Unlimited individual data', 'Personalised and priority service'], action: { label: 'Get started', href: '#' } },
],
} = Astro.props
const icons = [Zap, Layers2, Layers3]
---
<Section spacing="large">
<div class="group/pricing flex flex-col gap-12 md:gap-16">
<div class="flex flex-col items-stretch gap-8 sm:items-center md:gap-12">
<SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="large" align="center" />
<SegmentedControl name="billing" options={[{ label: periods.monthly, value: 'monthly' }, { label: periods.annual, value: 'annual' }]} value="monthly" aria-label={periodLabel} size="large" />
</div>
<div class="grid gap-4 md:grid-cols-2 md:gap-8 xl:grid-cols-3 items-end">
{items.map((plan, i) => {
const Icon = icons[i % icons.length]!
return (
<div class="flex flex-col gap-8 bg-primary-faded px-6 py-8 md:px-8 md:py-10">
<div class="flex flex-col items-center gap-3 text-center">
<FeaturedIcon theme="solid" color="primary" size="large"><Icon /></FeaturedIcon>
<Heading as="h3" size="h5" class="text-primary">{plan.name}</Heading>
<p class="flex items-baseline justify-center gap-1"><span class="text-5xl md:text-6xl font-semibold tracking-tight tabular-nums"><span class="group-has-[[value=annual]:checked]/pricing:hidden">{plan.price}</span><span class="hidden group-has-[[value=annual]:checked]/pricing:inline">{plan.annualPrice ?? plan.price}</span></span>{plan.period && <span class="text-neutral-faded">/{plan.period}</span>}</p>
<p class="text-neutral-faded">{plan.description}</p>
</div>
<ul class="flex list-none flex-col gap-4 p-0 text-neutral-faded flex-1">
{plan.features.map((f) => <li class="flex gap-3"><CircleCheck class="size-6 shrink-0 text-primary" aria-hidden="true" /><span>{f}</span></li>)}
</ul>
<Button href={plan.action.href} size="large" fullWidth>{plan.action.label}</Button>
</div>
)
})}
</div>
</div>
</Section>Add
npx @ava-ui/apogee add pricing/primary-card-icon
This copies the block to src/components/apogee/blocks/pricing/ with everything it uses: Button, FeaturedIcon, Heading, Section, SectionHeader, SegmentedControl. 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
PricingPlan tiers side by side, with an optional monthly / annual switch.
SegmentedControlA row of connected, mutually exclusive options backed by native radios — pick one from a small, always-visible set.
TableA styled, horizontally-scrollable table. Write plain thead/tbody markup — Table only styles it.