StealThis .dev

Travel — Trip Budget Indicator

A trip budget planner that turns numbers into a clear money picture for a fictional Kyoto and Inland Sea journey. Set a total budget, then split it across flights, stay, food, activities and transport with paired sliders and currency-formatted inputs. A single stacked bar shows each category as a coloured segment, a live summary reports allocated, remaining, per-day and per-person figures, and the bar plus remaining value flip to a striped red over-budget state with a toast whenever spending tips past the limit.

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

Code

Trip Budget Indicator

A compact budget planner for a fictional Kyoto & the Inland Sea trip. A serif editorial hero with a layered CSS/SVG coastline sets the mood, then a money-first card lets you type a total budget and watch it split across five categories — flights, stay, food, activities and transport. Each row pairs a coloured slider with a currency input so you can drag or type, and every category shows its share as a percentage of the budget.

The heart of the component is one stacked budget bar: each category is a coloured segment whose width tracks its amount, with a matching legend and a scale beneath. A live summary reports the allocated total, what is remaining, and the per-day and per-person-per-day figures, all formatted as USD with Intl.NumberFormat. The moment your allocations exceed the budget, the bar gains a striped red overspend marker, the remaining value flips to a red “Over budget” state, and a toast tells you exactly how far over you are.

Every interaction works in vanilla JS with no libraries. Sliders and number fields stay in sync, “Reset to suggested” restores a sensible default split, the slider range adapts to your budget, and controls are keyboard-usable with visible focus rings. Contrast meets WCAG AA and the layout collapses gracefully to a single column down to ~360px.

Illustrative travel UI only — fictional destinations, prices, and maps.