Starter
For side projects and first launches.
$0 / month
Start for free- 1 project
- 10k events a month
- Community support
Three pricing cards with a monthly or yearly switch, a highlighted plan and animated prices.
Svelte 5 · Version 1.0.0 · Zero extra packages
For side projects and first launches.
$0 / month
Start for freeFor teams shipping every week.
$29 / month
Start 14-day trialFor companies with compliance needs.
$99 / month
Talk to salesOne highlighted plan anchors the choice, and the yearly switch shows the saving without a second table. Original Svelte 5 implementation. No code was copied from the inspiring component.
Inspired by Toggle Pricing Cards by @diarmuradi on 21st.dev ↗
Pass plans with name, description, monthly, yearly, features, cta, href and optional featured. Set currency and saving text. Use real prices.
You may copy and adapt this original SaaSCrisp implementation in personal and commercial websites.
<script lang="ts">
type Plan = {
name: string;
description: string;
monthly: number;
yearly: number;
features: string[];
cta: string;
href: string;
featured?: boolean;
};
let { plans, currency = '$', saving = 'Save 20%' }: { plans: Plan[]; currency?: string; saving?: string } = $props();
const id = $props.id();
let yearly = $state(false);
</script>
<div class="pr">
<div class="pr-toggle" role="group" aria-label="Billing period">
<span class="pr-thumb" class:right={yearly} aria-hidden="true"></span>
<button type="button" aria-pressed={!yearly} onclick={() => (yearly = false)}>Monthly</button>
<button type="button" aria-pressed={yearly} onclick={() => (yearly = true)}>
Yearly <span class="pr-save">{saving}</span>
</button>
</div>
<div class="pr-grid">
{#each plans as plan, index (plan.name)}
<article class:featured={plan.featured} aria-labelledby="{id}-{index}">
{#if plan.featured}<span class="pr-popular">Most popular</span>{/if}
<h3 id="{id}-{index}">{plan.name}</h3>
<p class="pr-desc">{plan.description}</p>
<p class="pr-price">
{#key yearly}
<strong>{currency}{yearly ? plan.yearly : plan.monthly}</strong>
{/key}
<span>/ month{yearly ? ', billed yearly' : ''}</span>
</p>
<a class="pr-cta" href={plan.href}>{plan.cta}</a>
<ul>
{#each plan.features as feature (feature)}
<li>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg>
{feature}
</li>
{/each}
</ul>
</article>
{/each}
</div>
</div>
<style>
.pr {
--_bg: var(--ui-bg, #ffffff);
--_border: var(--ui-border, rgb(15 23 42 / 0.1));
--_text: var(--ui-text, #0f172a);
--_muted: var(--ui-muted, #64748b);
--_accent: var(--ui-accent, #4f46e5);
--_on-accent: var(--ui-on-accent, #ffffff);
container-type: inline-size;
display: grid;
justify-items: center;
gap: 28px;
color: var(--_text);
font-family: var(--ui-font, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
text-align: left;
}
.pr-toggle {
position: relative;
display: grid;
grid-template-columns: 1fr 1fr;
padding: 4px;
border: 1px solid var(--_border);
border-radius: 999px;
background: #f1f5f9;
}
.pr-thumb {
position: absolute;
inset: 4px 50% 4px 4px;
border-radius: 999px;
background: #fff;
box-shadow:
0 1px 2px rgb(15 23 42 / 0.12),
0 0 0 1px rgb(15 23 42 / 0.06);
transition: inset 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pr-thumb.right {
inset: 4px 4px 4px 50%;
}
.pr-toggle button {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 8px 18px;
border: 0;
border-radius: 999px;
background: none;
color: var(--_muted);
font: inherit;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: color 0.2s;
}
.pr-toggle [aria-pressed='true'] {
color: var(--_text);
}
.pr-save {
padding: 2px 7px;
border-radius: 999px;
background: color-mix(in srgb, var(--_accent) 15%, transparent);
color: var(--_accent);
font-size: 11px;
font-weight: 600;
}
.pr-grid {
display: grid;
gap: 14px;
width: 100%;
}
@container (min-width: 760px) {
.pr-grid {
grid-template-columns: repeat(var(--ui-columns, 3), 1fr);
align-items: stretch;
}
}
article {
position: relative;
display: flex;
flex-direction: column;
padding: 24px;
border: 1px solid var(--_border);
border-radius: 20px;
background: var(--_bg);
}
article.featured {
border-color: transparent;
background:
linear-gradient(var(--_bg), var(--_bg)) padding-box,
linear-gradient(160deg, var(--_accent), rgb(15 23 42 / 0.08) 45%, rgb(15 23 42 / 0.04)) border-box;
box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--_accent) 40%, transparent);
}
.pr-popular {
position: absolute;
top: 22px;
right: 22px;
padding: 3px 9px;
border-radius: 999px;
background: color-mix(in srgb, var(--_accent) 14%, transparent);
color: var(--_accent);
font-size: 11px;
font-weight: 600;
}
h3 {
margin: 0;
color: var(--_text);
font-size: 16px;
font-weight: 600;
}
.pr-desc {
margin: 6px 0 0;
color: var(--_muted);
font-size: 14px;
line-height: 1.5;
}
.pr-price {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 6px;
margin: 22px 0 0;
}
.pr-price strong {
font-size: 40px;
font-weight: 600;
font-variant-numeric: tabular-nums;
letter-spacing: -0.04em;
line-height: 1;
animation: pr-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pr-price span {
color: var(--_muted);
font-size: 13px;
}
.pr-cta {
display: grid;
place-items: center;
height: 40px;
margin-top: 22px;
border: 1px solid var(--_border);
border-radius: 10px;
background: rgb(15 23 42 / 0.04);
color: var(--_text);
font-size: 14px;
font-weight: 500;
text-decoration: none;
transition: background-color 0.15s;
}
.pr-cta:hover {
background: rgb(15 23 42 / 0.08);
}
.featured .pr-cta {
border-color: transparent;
background: var(--_accent);
color: var(--_on-accent);
}
.featured .pr-cta:hover {
background: color-mix(in srgb, var(--_accent) 88%, #000);
}
.pr-cta:focus-visible,
.pr-toggle button:focus-visible {
outline: 2px solid var(--_accent);
outline-offset: 2px;
}
ul {
display: grid;
gap: 10px;
margin: 22px 0 0;
padding: 22px 0 0;
border-top: 1px solid var(--_border);
list-style: none;
}
li {
display: flex;
align-items: flex-start;
gap: 10px;
color: var(--_text);
font-size: 14px;
line-height: 1.4;
}
li svg {
flex-shrink: 0;
width: 16px;
height: 16px;
margin-top: 1px;
fill: none;
stroke: var(--_accent);
stroke-width: 2.2;
stroke-linecap: round;
stroke-linejoin: round;
}
@keyframes pr-in {
from {
opacity: 0;
translate: 0 6px;
}
}
@media (prefers-reduced-motion: reduce) {
.pr-thumb,
.pr-price strong {
transition: none;
animation: none;
}
}
</style>
Use the SaaSCrisp UI Library MCP at https://www.saascrisp.com/api/library/mcp. Retrieve pricing-tiers version 1.0.0 for svelte with get_ui_asset. Preview: https://www.saascrisp.com/library/pricing-tiers. Confirm the project's stack, reuse local primitives and map CSS variables to existing design tokens. Integrate the files and run the project's checks. Report changed files and additional dependencies.