Motionshelf
← All components

Commerce

Plan Toggle

The switch slides from monthly to yearly, the prices roll like an odometer and the discount badge pops in.

Install

npx shadcn@latest add https://motionshelf-pi.vercel.app/r/plan-toggle.json

Copies the file into your project. Requires React 19, Tailwind CSS v4 and GSAP (installed as a dependency).

Props

NameTypeDefaultDescription
plansPlan[]3 plansPlans in order: name, monthly and yearly price per month (whole numbers), features.
featurednumber1Index of the highlighted plan.
featuredLabelstring"Popular"Badge on the highlighted plan.
currencystring"$"Currency symbol before the price.
periodstring"/mo"Text after the price.
labels[string, string]["Monthly", "Yearly"]Labels of the two sides of the switch.
discountstring"-20%"Badge next to the yearly label.
billing[string, string]["billed monthly", "billed yearly"]Line under the price on each side.
accentstring"#1f5bff"Color of the switch, the badge and the highlighted plan.
loopbooleantrueReplay forever with a pause between runs.
classNamestring""Extra classes for the outer element.

Dependencies

  • gsap
  • @gsap/react