PlanPicker
Plans as a radio list. One tinted block glides to the chosen plan, the radio fills with a pop and arrow keys move the choice. Pricing.
Open playgroundAbout
PlanPicker is a React component in the Pricing category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { PlanPicker } from "@ashutoshswamy/smoui" and set plans, value, currency.
Install
npm i @ashutoshswamy/smouiUsage
import { PlanPicker } from "@ashutoshswamy/smoui";
<PlanPicker defaultValue="pro" plans={[{ id: "free", name: "Free", price: 0 }, { id: "pro", name: "Pro", price: 19, badge: "Popular" }]} onChange={(id) => setPlan(id)} />Props 3
- plans
Price is a number in whole units.
{ id; name; price; description?; badge? }[]- value / defaultValue / onChange
Selected plan.
string / string / (id) => void- currency / period
Price affixes.
stringdefault"$" / "/mo"
More pricing components
- BillingToggleMonthly/yearly switch. The thumb stretches to the choice and a savings badge pops in on yearly.
- OrderSummaryA checkout total. Type a promo code and a discount line slides in while the total rolls down; a wrong code shakes the field.
- PlanCompareFeature comparison. One column highlight stretches to the column you point at; rows and ticks cascade in.
- PricingCardOne plan card. Price rolls with billing, features tick in on scroll, the featured card sits on grainy mesh.
- PricingSliderUsage-based pricing. Drag the jelly thumb through tiers; the label rides its bubble and the price rolls.
- PricingTablePlans with a monthly/yearly switch. Prices roll to their new value; one highlight stretches between plans.