Pricing with monthly / yearly toggle

Three plan cards whose prices switch between monthly and yearly billing with one toggle button; amounts are formatted with the money filter.

state-toggledata-state-togglepricingbillingmonthlyyearlymoneytoggleplansstate

About this block

One button carries data-state-toggle="billing:yearly|monthly". Each click flips the billing key between the two values; every price is a pair of spans that data-state-show reveals for its own value. Amounts are stored in cents and formatted by the money filter.

How to customize it

  • Set the three assign lines at the top to your monthly prices in cents (1900 is $19.00). The yearly price is ten months: times: 10 | divided_by: 12 shows it per month.
  • data-state-toggle="key:first|second" sets the first value on the first click. Without a pipe it flips the key between set and unset.
  • The yearly spans start hidden so the page is correct before scripting loads.

Browse other blocks

Same library cards — preview live and grab the code from any block.

View full library