StealThis .dev

Nonprofit — Giving Toggle

A warm, donor-ready giving toggle that lets supporters switch between one-time and monthly gifts with a single segmented control. Choosing monthly surfaces a most-impact badge, rewrites the supporting copy, relabels every preset amount, and projects an annual total alongside a friendly impact line. Preset chips and a custom amount field stay in sync, an animated progress thermometer anchors the campaign, and trust badges plus recent donors reinforce transparency — all self-contained vanilla HTML, CSS and JavaScript.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Giving Toggle

A donation card for the fictional Bright Wells Foundation built around a single, high-stakes decision: give once or give monthly. The frequency control is a pill-style segmented switch with a sliding indicator and a “Most impact” badge pinned to the monthly option. Flipping it rewrites the supporting copy, relabels every preset amount (“per month” vs “one-time”), recomputes the dynamic impact line, and refreshes the donate button label — so the consequences of the choice are always visible.

Four preset amounts and a custom input stay perfectly in sync: picking a chip clears the custom field, typing a custom amount deselects the chips, and clearing the field gracefully falls back to the last preset. The annual-projection panel multiplies a monthly amount by twelve to preview the real yearly commitment, then translates it into human terms (“clean water for ~12 families for a full year”). A campaign thermometer, registered-charity badges, and a recent-donors list round out the trust signals.

Everything is keyboard-usable and announced via aria-live regions, the radiogroup supports arrow-key navigation, and a small toast() helper confirms the gift on submit. No frameworks, no build step — just three files.

Illustrative UI only — fictional organization, not a real charity or donation system.