A heading beside two grey plan cards with icons on their top edge.

Last updated

Open block
Show code
---
/**
 * Featured cards 03: A heading beside two grey plan cards with icons on their top edge.
 *
 * @block pricing
 * @order 7
 */
import { CircleCheck, Layers2, 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 { 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 = 'Upgrade',
  heading = 'Pricing plans that scale',
  description = 'Simple, transparent pricing that grows with you. Try any plan free for 30 days.',
  items = [
    { name: 'Basic plan', price: '$10', period: 'mth', description: 'Billed annually.', features: ['Access to 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', period: 'mth', description: 'Billed annually.', features: ['200+ integrations', 'Advanced reporting', 'Up to 20 individual users', '40 GB individual data', 'Priority chat and email support'], action: { label: 'Get started', href: '#' } },
  ],
} = Astro.props
const icons = [Zap, Layers2]
---

<Section spacing="large">
  <div class="grid gap-12 xl:grid-cols-[minmax(0,28rem)_1fr] xl:gap-16">
    <SectionHeader eyebrow={eyebrow ?? undefined} heading={plain(heading)} description={description ?? undefined} size="medium" />
    <div class="grid items-start gap-12 md:gap-8 md:grid-cols-2">
    {items.map((plan, i) => {
      const Icon = icons[i % icons.length]!
      return (
    <div class="relative mt-6 flex flex-col items-center gap-8 rounded-2xl bg-neutral-faded px-6 pt-12 pb-8 text-center md:px-8">
      <div class="absolute -top-6 start-1/2 -translate-x-1/2 rtl:translate-x-1/2"><FeaturedIcon theme="outline" color="neutral" size="large"><Icon /></FeaturedIcon></div>
      <div class="flex flex-col items-center gap-2">
        <Heading as="h3" size="h5">{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">{plan.price}</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 self-stretch text-start">
        {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 class="mt-auto">{plan.action.label}</Button>
    </div>
      )
    })}
    </div>
  </div>
</Section>

Add

npx @ava-ui/apogee add pricing/featured-cards-03

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