Skip to content
Feedback & Data

PricingSwitch

A monthly and yearly switch. The pill slides across while every price counts over to the new number, and a saving badge worked out from the two prices pops in.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
plans{ name, monthly, yearly, note?, features?, featured? }[]—Yearly is the price for the whole year. Names must be different.
defaultYearlybooleanfalseStart on the yearly side.
labels[string, string]["Monthly", "Yearly"]Text on the two sides of the switch.
units[string, string]["/mo", "/yr"]Text after the price on each side.
prefixstring"$"Text before the price.
decimalsnumber0Digits after the point.
localestring"en-US"Number format. en-IN gives lakh commas.
onChange(yearly) => void—Called when the switch moves.
onSelect(plan, yearly) => void—Called when a plan button is pressed. Leave out to hide the buttons.
buttonLabelstring"Choose plan"Text on the plan buttons.
accentstring"#a78bfa"Switch, featured plan and tick colour. Text on it stays dark, so pick a light colour.
classNamestringglass cardReplaces the plan card look.