Pricing Plans
A React pricing section with a monthly or yearly switch that rolls prices to the new value, a featured ink plan, and feature rows marked included or not.
Installation
npx shadcn@latest add @minidev/pricing-plans
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/pricing-plans.json
Usage
import { PricingPlans } from "@/components/ui/pricing-plans"
export function Example() {
return (
<PricingPlans />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| eyebrowSmall mono label above the title. Empty string hides it. | string | "Pricing" |
| titleSection heading (rendered as h2). | React.ReactNode | "Priced like a tool, not a hire." |
| description | React.ReactNode | "Per seat, per month. Change plans an... |
| plansPlans in display order. Defaults to Lumen's Starter, Team and Scale. | Plan[] | DEFAULT_PLANS |
| currencyISO 4217 code used to format prices, e.g. "USD", "EUR". | string | "USD" |
| yearlyBadgeDiscount badge on the yearly option. | string | "-20%" |
| onSelectCalled with the plan name and the selected period when a plan's button is pressed. | (plan: string, period: BillingPeriod) => void | - |
| periodControlled billing period. | BillingPeriod | - |
| defaultPeriodInitial billing period when uncontrolled. | BillingPeriod | "yearly" |
| onPeriodChangeCalled when the period switch changes. | (period: BillingPeriod) => void | - |
| unitPrice suffix, e.g. "/ seat / mo" or "/ mo". | string | "/ seat / mo" |
| perUsed in "Billed $X per seat yearly". Empty string drops it. | string | "per seat" |
| className | string | - |
When to use
Use on a marketing or /pricing page with two to four plans. Prices are numbers per month; the yearly figure is the monthly-equivalent price and the "Billed $X yearly" line is derived. A price of 0 reads "Free". For an existing customer's plan and invoices use BillingPage; for a premium animated variant use PricingMotion. Period is uncontrolled by default; pass period + onPeriodChange to control it.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Moves to the selected option of the period switch, then to each plan's button. |
| ArrowLeftorArrowRight | In the switch, moves to the other period and selects it. ArrowUp and ArrowDown do the same. |
| HomeorEnd | In the switch, selects Monthly or Yearly. |
Accessibility
- The section is labelled by its
<h2>title througharia-labelledby; each plan is an<article>with an<h3>name. - Each feature list has
aria-label"{plan} features". Excluded features add screen-reader text "(not included)", and the check and dash icons arearia-hidden. - Prices use NumberRoll, which keeps a screen-reader-only copy of the formatted price and swaps digits without rolling under reduced motion.
Frequently asked questions
How do I control the billing period, or know it when a plan is chosen?
Uncontrolled, it starts at defaultPeriod ("yearly"). Pass period and onPeriodChange to control it. onSelect(plan, period) receives the plan name and the period showing when the button was pressed.
How do I show a free plan or a feature a plan lacks?
A price of 0 renders "Free" with no unit and the line "Free forever for one person", which is fixed text. In features, a string is included and { label: "Alerts", included: false } renders muted with a dash.
Is `yearly` the annual price?
No, it is the monthly-equivalent price. The "Billed $468 per seat yearly" line is yearly * 12 formatted with currency. Set per="" to drop "per seat", and unit to change "/ seat / mo".
Dependencies
npm
Built from