Design and code by mameara — original work, no third-party libraries. Free to use and modify.
A pricing card is where a visitor actually decides. Most templates ship exactly one look: one color, one corner radius, one shadow. The moment you need a different one, you start editing CSS by trial and error — and you end up maintaining a second copy for every color.
This component takes the other route. Instead of writing variants, you move the controls and see the result instantly, then copy the variables out. The same six variables you see in the panel drive every card on the page.
What the controls actually change
| Control | Range | What it affects |
|---|---|---|
--accent | any color | Borders, badge, the subscribe button, and the tinted shadow — all derived from a single value |
--radius | 0 – 32px | Cards, the control panel, and buttons (computed proportionally, not hardcoded) |
--space | 0.7 – 1.5× | Inner padding, dividers, and the gap between cards |
| Glass | on / off | Translucent background with backdrop-filter |
| Dark | on / off | The same variables with inverted values — no second stylesheet |
| Billing | monthly / yearly | The displayed price on all three cards |
Why this beats one version per color
Because one thing changes and everything else is derived from it. The colored shadow isn’t a hand-picked hex value — it’s color-mix() of the accent. Change the accent from blue to green and every shadow, border, and translucent surface follows correctly, without touching a single line.
Dark mode works the same way. There is no second design. The values flip and the structure stays. That is what prevents the most common bug in dark themes: someone tweaks the light version and forgets the dark one.
How to use it
- Move the sliders until the cards look right.
- Press Copy in the variables panel — you get a ready
:rootblock. - Paste it at the top of your stylesheet, then use
var(--accent)wherever you need it.
If you want the whole component instead of just the tokens, use Copy code in the top bar — it copies the HTML, CSS, and JavaScript together.
Three details that matter
- Direction-agnostic layout: every offset is written with
padding-inlineandinset-inline-start, so the component mirrors itself in RTL without a second file. There is nomargin-leftanywhere. - No external fonts: the component uses the system font stack. Zero network requests, zero layout shift (CLS) while loading.
- Number isolation: the price sits inside
<bdi dir="ltr">so the currency symbol and digits never reorder when the same markup is mirrored into an RTL layout.
Ways to extend it
- Add a fourth plan with highlighted copy — the grid reflows to four columns on its own.
- Sync the billing switch with a URL state (
?billing=yearly) so you can share a link with yearly pricing already selected. - Wrap the control panel in a
<details>element on the live site, so visitors see the cards and only you see the knobs.
Quick questions
Can I use this commercially?
Yes. The code is original, written from scratch, with no third-party libraries. Use it as-is or modify it.
Does it work in older browsers?
color-mix() is supported in every current browser (2023+). If you need older support, replace it with precomputed static values — that part is a two-line change.
Why is there no static screenshot of the design?
Because a screenshot shows one state. Here the state itself is the content — you can try six different looks on the same page.
