# Pricing card

A billing toggle updates a crisp pricing summary and its next action.

## Usage

Use to compare billing choices with an explicit total. The example pricing is illustrative, not TDP pricing. Connect onChoose to a real checkout only after validating prices server-side.

Save the JSX and CSS Module in the same folder in a React project with CSS Modules support. Controlled components need parent state and change handlers.

## JSX

```jsx
"use client";
import styles from "./PricingCard.module.css";
import { useState } from "react";
export default function PricingCard({
  name = "Studio",
  monthly = 32,
  annualMonthly = 26,
  onChoose,
}) {
  const [annual, setAnnual] = useState(false);
  const [selected, setSelected] = useState(false);
  return (
    <div className={styles.root}>
      <div className={styles.head}>
        <span>{name}</span>
        <span className={styles.badge}>For small teams</span>
      </div>
      <button
        type="button"
        className={styles.billing}
        role="switch"
        aria-checked={annual}
        onClick={() => {
          setAnnual(!annual);
          setSelected(false);
        }}
      >
        Annual billing{" "}
        <span aria-hidden="true">
          <i />
        </span>
      </button>
      <div className={styles.price} key={String(annual)}>
        <strong>${annual ? annualMonthly : monthly}</strong>
        <span>/ month</span>
      </div>
      <p>
        {annual
          ? `$${annualMonthly * 12} billed yearly`
          : `$${monthly} billed monthly`}
      </p>
      <ul>
        <li>Shared projects</li>
        <li>Component collections</li>
        <li>Team feedback</li>
      </ul>
      <button
        type="button"
        className={styles.choose}
        onClick={() => {
          setSelected(true);
          onChoose?.({
            name,
            annual,
            amount: annual ? annualMonthly * 12 : monthly,
          });
        }}
      >
        Choose {name}
        <span aria-hidden="true">↗</span>
      </button>
      <small role="status">
        {selected
          ? "Plan selected. Demo only; no purchase made."
          : "Illustrative pricing · no checkout"}
      </small>
    </div>
  );
}

```

## CSS

```css
.root {
  width: 285px;
  padding: 24px;
  border: 1px solid var(--tdp-border, #d9d1c9);
  border-radius: var(--tdp-radius, 8px);
  background: var(--tdp-surface, #fffdfa);
  box-shadow: 0 10px 30px #38281b08;
  transition:
    translate 0.3s,
    box-shadow 0.3s;
}
.root:hover {
  translate: 0 -4px;
  box-shadow: 0 18px 35px #38281b14;
}
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
}
.badge {
  font-size: 9px;
  background: #e7def0;
  color: #665075;
  padding: 4px 7px;
  border-radius: 5px;
}
.billing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  background: transparent;
  font-size: 11px;
  color: var(--tdp-muted, #6b625b);
  padding: 0;
}
.billing > span {
  width: 32px;
  height: 20px;
  border-radius: 20px;
  background: #c9c0b7;
  padding: 3px;
  transition: background 0.2s;
}
.billing i {
  display: block;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: translate 0.2s;
}
.billing[aria-checked="true"] > span {
  background: var(--tdp-primary, #1f3934);
}
.billing[aria-checked="true"] i {
  translate: 12px 0;
}
.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 9px;
  animation: priceIn 0.3s ease-out;
}
.price strong {
  font-size: 46px;
  font-weight: 500;
  letter-spacing: -0.06em;
}
.price > span {
  font-size: 11px;
  color: var(--tdp-muted, #6b625b);
}
.root p {
  font-size: 10px;
  color: var(--tdp-muted, #6b625b);
  margin: 0 0 18px;
}
.root ul {
  padding: 14px 0;
  margin: 0 0 12px;
  border-top: 1px solid var(--tdp-border, #d9d1c9);
  list-style: none;
  font-size: 11px;
  line-height: 2.1;
}
.root li::before {
  content: "✓";
  margin-right: 10px;
  color: #577847;
}
.choose {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  background: var(--tdp-primary, #1f3934);
  color: var(--tdp-on-primary, #fff);
  border: 0;
  border-radius: var(--tdp-radius, 8px);
  font-size: 12px;
}
.root small {
  display: block;
  min-height: 28px;
  margin-top: 12px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--tdp-muted, #6b625b);
}
@keyframes priceIn {
  from {
    opacity: 0.4;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.root {
  font-family: var(--tdp-font, "DM Sans", system-ui, sans-serif);
  color: var(--tdp-text, #302e2b);
  max-width: 100%;
  box-sizing: border-box;
}
.root * {
  box-sizing: border-box;
}
.root :is(button, input, a):focus-visible,
.root:focus-visible {
  outline: 3px solid var(--tdp-focus, #7851a9);
  outline-offset: 4px;
}
.root button {
  font: inherit;
  cursor: pointer;
}
.root button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.root button,
.root a {
  touch-action: manipulation;
}
@media (prefers-reduced-motion: reduce) {
  .root,
  .root *,
  .root::before,
  .root::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    translate: none !important;
    rotate: none !important;
    scale: none !important;
    scroll-behavior: auto !important;
  }
}

```

## Props

- name (string): Plan label.
- monthly (number): Monthly billed price in USD.
- annualMonthly (number): Monthly equivalent for an annual plan.
- onChoose (function): Receives the selected plan and billing amount.

## Accessibility

Annual billing is a named switch. The yearly total stays visible; the button does not imply a completed purchase. Price movement respects reduced motion.

Check accessibility again after customizing the component.

[Browse all components](/resources/components/)

Canonical: https://designproject.io/resources/components/pricing-card/

## Keep learning

- [How to create a UI color palette, step by step](https://designproject.io/resources/guides/create-ui-color-palette/)
- [Product design glossary: 44 terms explained](https://designproject.io/resources/glossary/)
- [How to choose font pairings for a product interface](https://designproject.io/resources/guides/choose-font-pairings/)
