CTA
JS behaviour
Pricing CTA card
A call-to-action card with a monthly/yearly toggle: the price rolls up and out while the new one rolls in from below, the yearly savings light up as a green badge, and the primary button sits above a money-back guarantee line.
Real scenarios
The component as it is used in a product — not a specimen grid.
Most popular
Pro plan
For teams that take their releases seriously.
$
You save $96 a year
- Unlimited dashboards per workspace
- Slack alerts and webhooks
- 90 days of event retention
30-day money-back guarantee — if it doesn’t click, one email is enough.
Cancel anytime
SOC 2 Type II
EU & Singapore data residency
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| billing | state | 'monthly' | The monthly/yearly toggle; the whole card — price, billing note and savings badge — follows it instantly. |
| price | number | '19 · 15' | USD per seat per month; when the period flips the old figure rolls up and out as the new one rolls in from below. |
| save-badge | string | 'Save $96 a year' | The savings badge that appears only in yearly mode; its number is the real difference between the two periods. |
| guarantee | string | '30-day money-back' | The guarantee line under the primary button; it lifts the purchase anxiety and carries a shield icon. |
Snippet
<div class="ctpr-card">
<div class="ctpr-toggle" role="radiogroup" aria-label="Billing period">
<label><input type="radio" name="ctpr-b" checked><span>Monthly</span></label>
<label><input type="radio" name="ctpr-b" id="ctpr-y"><span>Yearly</span></label>
</div>
<div class="ctpr-figure">
<span class="ctpr-num" data-m>19</span>
<span class="ctpr-num" data-y>15</span>
<small>$ per seat / month</small>
</div>
<span class="ctpr-save">You save $96 a year</span>
<button class="ctpr-go">Upgrade to Pro</button>
<small class="ctpr-guarantee">30-day money-back guarantee</small>
</div>
<style>
.ctpr-card { display: grid; gap: 1rem; justify-items: center; inline-size: 22rem; padding: 2rem;
border: 1px solid #e5e7eb; border-radius: 20px; }
.ctpr-num { grid-area: 1 / 1; font-size: 3rem; font-weight: 800;
transition: opacity .22s, translate .22s; }
.ctpr-num[data-y] { opacity: 0; translate: 0 .4em; }
.ctpr-card:has(#ctpr-y:checked) .ctpr-num[data-m] { opacity: 0; translate: 0 -.4em; }
.ctpr-card:has(#ctpr-y:checked) .ctpr-num[data-y] { opacity: 1; translate: 0 0; }
.ctpr-save { opacity: 0; font-size: .8rem; color: #059669; transition: opacity .2s; }
.ctpr-card:has(#ctpr-y:checked) .ctpr-save { opacity: 1; }
</style>
// app/Pages/Pricing.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import PricingCta from '@/components/PricingCta';
export default function Pricing() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<PricingCta />
</main>
</NabuXUIProvider>
);
}
// PricingCta.jsx — monthly/yearly toggle with a rolling price
import { useState } from 'react';
import '@nabuxai/ui-core/css';
export default function PricingCta() {
const [yearly, setYearly] = useState(false);
const price = yearly ? 15 : 19;
return (
<>
<style>{`
.ctpr-card { display: grid; gap: 1.1rem; justify-items: center; inline-size: min(100%, 24rem);
padding: 2rem 1.75rem; border: 1px solid #e5e7eb; border-radius: 1.25rem;
background: #fff; box-shadow: 0 18px 40px #0a0c1714;
font-family: Inter, system-ui, sans-serif; }
.ctpr-top { display: grid; gap: .35rem; justify-items: center; text-align: center; }
.ctpr-plan { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5647e6; }
.ctpr-toggle { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: #eeeff4; }
.ctpr-seg { block-size: 2.25rem; padding-inline: 1.1rem; border: none; border-radius: 999px;
background: transparent; font: 600 .875rem/1 Inter, sans-serif; color: #555a70; cursor: pointer;
transition: background-color .18s, color .18s; }
.ctpr-seg[aria-pressed='true'] { background: #fff; color: #1e1a4a; box-shadow: 0 2px 8px #0a0c1721; }
.ctpr-figure { display: flex; align-items: baseline; gap: .4rem; }
.ctpr-nums { display: grid; }
.ctpr-num { grid-area: 1 / 1; font: 800 3.25rem/1 Inter, sans-serif; letter-spacing: -.03em; color: #141726;
animation: ctpr-in .26s ease both; }
@keyframes ctpr-in { from { opacity: 0; translate: 0 .4em; } }
.ctpr-per { font-size: .8rem; color: #6c7088; }
.ctpr-save { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem;
border-radius: 999px; background: #10b9811f; color: #047857; font-size: .78rem; font-weight: 600; }
.ctpr-go { display: flex; justify-content: center; align-items: center; gap: .5rem; inline-size: 100%;
block-size: 3rem; border: none; border-radius: 999px; background: #5647e6; color: #fff;
font: 700 .9375rem/1 Inter, sans-serif; cursor: pointer;
transition: translate .18s, box-shadow .18s, background-color .18s; }
.ctpr-go:hover { translate: 0 -2px; background: #4739ca; box-shadow: 0 12px 26px #5647e638; }
.ctpr-guarantee { font-size: .78rem; color: #6c7088; }
@media (prefers-reduced-motion: reduce) {
.ctpr-num { animation: none; }
.ctpr-go, .ctpr-seg { transition: none; }
}
`}</style>
<div className="ctpr-card">
<div className="ctpr-top">
<span className="ctpr-plan">Pro</span>
<div className="ctpr-toggle" role="group" aria-label="Billing period">
<button type="button" className="ctpr-seg" aria-pressed={!yearly} onClick={() => setYearly(false)}>Monthly</button>
<button type="button" className="ctpr-seg" aria-pressed={yearly} onClick={() => setYearly(true)}>Yearly −20%</button>
</div>
</div>
{/* The active figure mounts with the roll-in animation. */}
<div className="ctpr-figure">
<span className="ctpr-nums">
<span className="ctpr-num" key={price}>${price}</span>
</span>
<span className="ctpr-per">per seat / month</span>
</div>
{yearly && (
<span className="ctpr-save">✓ You save $96 a year — billed once</span>
)}
<button type="button" className="ctpr-go">Upgrade to Pro</button>
<small className="ctpr-guarantee">30-day money-back guarantee · cancel anytime</small>
</div>
</>
);
}
<!-- PricingCta.vue — monthly/yearly toggle with a rolling price -->
<script setup lang="ts">
import { computed, ref } from 'vue';
import '@nabuxai/ui-core/css';
const yearly = ref(false);
const price = computed(() => (yearly.value ? 15 : 19));
</script>
<template>
<div class="ctpr-card">
<div class="ctpr-top">
<span class="ctpr-plan">Pro</span>
<div class="ctpr-toggle" role="group" aria-label="Billing period">
<button type="button" class="ctpr-seg" :aria-pressed="!yearly" @click="yearly = false">Monthly</button>
<button type="button" class="ctpr-seg" :aria-pressed="yearly" @click="yearly = true">Yearly −20%</button>
</div>
</div>
<!-- The active figure mounts with the roll-in animation. -->
<div class="ctpr-figure">
<span class="ctpr-nums">
<span :key="price" class="ctpr-num">${{ price }}</span>
</span>
<span class="ctpr-per">per seat / month</span>
</div>
<span v-if="yearly" class="ctpr-save">✓ You save $96 a year — billed once</span>
<button type="button" class="ctpr-go">Upgrade to Pro</button>
<small class="ctpr-guarantee">30-day money-back guarantee · cancel anytime</small>
</div>
</template>
<style scoped>
.ctpr-card { display: grid; gap: 1.1rem; justify-items: center; inline-size: min(100%, 24rem);
padding: 2rem 1.75rem; border: 1px solid #e5e7eb; border-radius: 1.25rem;
background: #fff; box-shadow: 0 18px 40px #0a0c1714;
font-family: Inter, system-ui, sans-serif; }
.ctpr-top { display: grid; gap: .35rem; justify-items: center; text-align: center; }
.ctpr-plan { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5647e6; }
.ctpr-toggle { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: #eeeff4; }
.ctpr-seg { block-size: 2.25rem; padding-inline: 1.1rem; border: none; border-radius: 999px;
background: transparent; font: 600 .875rem/1 Inter, sans-serif; color: #555a70; cursor: pointer;
transition: background-color .18s, color .18s; }
.ctpr-seg[aria-pressed='true'] { background: #fff; color: #1e1a4a; box-shadow: 0 2px 8px #0a0c1721; }
.ctpr-figure { display: flex; align-items: baseline; gap: .4rem; }
.ctpr-nums { display: grid; }
.ctpr-num { grid-area: 1 / 1; font: 800 3.25rem/1 Inter, sans-serif; letter-spacing: -.03em; color: #141726;
animation: ctpr-in .26s ease both; }
@keyframes ctpr-in { from { opacity: 0; translate: 0 .4em; } }
.ctpr-per { font-size: .8rem; color: #6c7088; }
.ctpr-save { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem;
border-radius: 999px; background: #10b9811f; color: #047857; font-size: .78rem; font-weight: 600; }
.ctpr-go { display: flex; justify-content: center; align-items: center; gap: .5rem; inline-size: 100%;
block-size: 3rem; border: none; border-radius: 999px; background: #5647e6; color: #fff;
font: 700 .9375rem/1 Inter, sans-serif; cursor: pointer;
transition: translate .18s, box-shadow .18s, background-color .18s; }
.ctpr-go:hover { translate: 0 -2px; background: #4739ca; box-shadow: 0 12px 26px #5647e638; }
.ctpr-guarantee { font-size: .78rem; color: #6c7088; }
@media (prefers-reduced-motion: reduce) {
.ctpr-num { animation: none; }
.ctpr-go, .ctpr-seg { transition: none; }
}
</style>
<!-- PricingCta.svelte — monthly/yearly toggle with a rolling price -->
<script lang="ts">
import '@nabuxai/ui-core/css';
let yearly = $state(false);
const price = $derived(yearly ? 15 : 19);
</script>
<div class="ctpr-card">
<div class="ctpr-top">
<span class="ctpr-plan">Pro</span>
<div class="ctpr-toggle" role="group" aria-label="Billing period">
<button type="button" class="ctpr-seg" aria-pressed={!yearly} onclick={() => (yearly = false)}>Monthly</button>
<button type="button" class="ctpr-seg" aria-pressed={yearly} onclick={() => (yearly = true)}>Yearly −20%</button>
</div>
</div>
<!-- The active figure mounts with the roll-in animation. -->
<div class="ctpr-figure">
<span class="ctpr-nums">
<span class="ctpr-num">{#key price}<span class="ctpr-num-inner">${price}</span>{/key}</span>
</span>
<span class="ctpr-per">per seat / month</span>
</div>
{#if yearly}
<span class="ctpr-save">✓ You save $96 a year — billed once</span>
{/if}
<button type="button" class="ctpr-go">Upgrade to Pro</button>
<small class="ctpr-guarantee">30-day money-back guarantee · cancel anytime</small>
</div>
<style>
.ctpr-card { display: grid; gap: 1.1rem; justify-items: center; inline-size: min(100%, 24rem);
padding: 2rem 1.75rem; border: 1px solid #e5e7eb; border-radius: 1.25rem;
background: #fff; box-shadow: 0 18px 40px #0a0c1714;
font-family: Inter, system-ui, sans-serif; }
.ctpr-top { display: grid; gap: .35rem; justify-items: center; text-align: center; }
.ctpr-plan { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5647e6; }
.ctpr-toggle { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: #eeeff4; }
.ctpr-seg { block-size: 2.25rem; padding-inline: 1.1rem; border: none; border-radius: 999px;
background: transparent; font: 600 .875rem/1 Inter, sans-serif; color: #555a70; cursor: pointer;
transition: background-color .18s, color .18s; }
.ctpr-seg[aria-pressed='true'] { background: #fff; color: #1e1a4a; box-shadow: 0 2px 8px #0a0c1721; }
.ctpr-figure { display: flex; align-items: baseline; gap: .4rem; }
.ctpr-nums { display: grid; }
.ctpr-num { grid-area: 1 / 1; }
.ctpr-num-inner { display: inline-block; font: 800 3.25rem/1 Inter, sans-serif; letter-spacing: -.03em; color: #141726;
animation: ctpr-in .26s ease both; }
@keyframes ctpr-in { from { opacity: 0; translate: 0 .4em; } }
.ctpr-per { font-size: .8rem; color: #6c7088; }
.ctpr-save { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem;
border-radius: 999px; background: #10b9811f; color: #047857; font-size: .78rem; font-weight: 600; }
.ctpr-go { display: flex; justify-content: center; align-items: center; gap: .5rem; inline-size: 100%;
block-size: 3rem; border: none; border-radius: 999px; background: #5647e6; color: #fff;
font: 700 .9375rem/1 Inter, sans-serif; cursor: pointer;
transition: translate .18s, box-shadow .18s, background-color .18s; }
.ctpr-go:hover { translate: 0 -2px; background: #4739ca; box-shadow: 0 12px 26px #5647e638; }
.ctpr-guarantee { font-size: .78rem; color: #6c7088; }
@media (prefers-reduced-motion: reduce) {
.ctpr-num-inner { animation: none; }
.ctpr-go, .ctpr-seg { transition: none; }
}
</style>