An agency pricing section that shows real availability (2027)

Build a pricing section in React that sells scarcity honestly: each plan shows the months it can still start in, booked ones struck through, with a per-project or retainer switch and counting prices.

6 min read

The real component. Click the picture to open it live and try it before you read how it was built.

"Only two spots left" is usually invented. This pricing section shows the real calendar instead: every plan lists the months it can still start in.

Months you can pick

Under each price, the next months are a row of cells. Booked ones are struck through and out of reach; open ones can be picked, and a solid marker slides to the chosen month. Picking one rewrites the timeline and the button.

src/registry/pricing/availability/month-strip.tsx

"use client";

import { motion } from "motion/react";
import { SPRING_SNAPPY } from "@/lib/motion";
import { cn } from "@/lib/utils";
import type { PlanTone } from "./plan-tone";
import { formatMonth, getMonthKey } from "./schedule";

interface MonthStripProps {
  // Kick-off days, one per month, as ISO days.
  kickoffs: string[];
  bookedMonths: string[];
  selected: string | null;
  onSelect: (kickoff: string) => void;
  tone: PlanTone;
  locale: string;
  // Tells the plan cards' sliding markers apart.
  planName: string;
}

// The next months as a row of cells: booked ones struck through and out of reach, open ones selectable. The chosen
// month wears a solid marker that slides between cells.
export function MonthStrip({ kickoffs, bookedMonths, selected, onSelect, tone, locale, planName }: MonthStripProps) {
  return (
    <div role="group" aria-label={`Start month for ${planName}`} className="grid grid-cols-6 gap-1">
      {kickoffs.map((kickoff) => {
        const isBooked = bookedMonths.includes(getMonthKey(kickoff));
        const isSelected = kickoff === selected;
        const monthName = formatMonth(kickoff, locale, "long");
        return (
          <button
            key={kickoff}
            type="button"
            disabled={isBooked}
            aria-pressed={isSelected}
            aria-label={isBooked ? `${monthName}, fully booked` : monthName}
            onClick={() => onSelect(kickoff)}
            className={cn(
              "relative isolate flex h-11 items-center justify-center overflow-hidden rounded-lg border text-xs font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
              isBooked ? cn("cursor-not-allowed border-transparent", tone.cellBooked) : tone.cellOpen,
              isSelected && tone.cellSelected,
            )}
          >
            {isSelected && (
              <motion.span
                layoutId={`month-marker-${planName}`}
                transition={SPRING_SNAPPY}
                className={cn("absolute inset-0 -z-10", tone.marker)}
              />
            )}
            {isBooked && <span aria-hidden className={cn("absolute inset-x-1 top-1/2 h-px -rotate-30", tone.cross)} />}
            {formatMonth(kickoff, locale, "short")}
          </button>
        );
      })}
    </div>
  );
}
The month strip

A switch that counts

A segmented switch flips between per-project and retainer. It is a radio group, so arrow keys work, and the prices count from the old figure to the new one while the unit trades places. Reduced motion swaps both at once.

src/registry/pricing/availability/plan-price.tsx

"use client";

import { AnimatePresence, motion, useTransform } from "motion/react";
import { EASE_OUT } from "@/lib/motion";
import { cn } from "@/lib/utils";
import { useAnimatedNumber } from "@/hooks/use-animated-number";
import { usePrefersReducedMotion } from "@/hooks/use-prefers-reduced-motion";
import { formatPrice } from "./schedule";

const COUNT_S = 0.6;

interface PlanPriceProps {
  amount: number;
  unit: string;
  currency: string;
  locale: string;
  mutedClassName: string;
  className?: string;
}

// The price counts from the old figure to the new one when the billing mode flips, and the unit under it trades
// places with a short rise. Reduced motion swaps both at once.
export function PlanPrice({ amount, unit, currency, locale, mutedClassName, className }: PlanPriceProps) {
  const isStill = usePrefersReducedMotion();
  const value = useAnimatedNumber(amount, COUNT_S);
  const text = useTransform(value, (current) => formatPrice(Math.round(current), currency, locale));

  return (
    <p className={cn("flex flex-col gap-1", className)}>
      <span className="sr-only">{formatPrice(amount, currency, locale)}</span>
      <motion.span aria-hidden className="text-5xl leading-none font-medium tracking-tighter tabular-nums">
        {text}
      </motion.span>
      <span className={cn("relative h-5 overflow-hidden text-sm", mutedClassName)}>
        <AnimatePresence mode="popLayout" initial={false}>
          <motion.span
            key={unit}
            initial={isStill ? false : { y: "100%", opacity: 0 }}
            animate={{ y: 0, opacity: 1 }}
            exit={isStill ? { opacity: 0, transition: { duration: 0 } } : { y: "-100%", opacity: 0 }}
            transition={{ duration: 0.35, ease: EASE_OUT }}
            className="block"
          >
            {unit}
          </motion.span>
        </AnimatePresence>
      </span>
    </p>
  );
}
The counting price

One dark plan, one set of tokens

The featured plan is inverted to dark by swapping its colour tokens, not by a second layout, so both cards stay in step.

More articles