shadcn.io is not affiliated with official shadcn/ui
Budget Allocation Onboarding Block for Radix UI
A setup panel that splits an editable monthly total across four categories with linked sliders that stop at what is unassigned, and a share bar with percents that add to 100.
Installation
Overview
Split a monthly budget at the start, with this budgets step for React with Radix UI. It is a setup panel of Pursemoor, a freelancer finance app: a compact header over one framed panel in four bands. A toolbar holds the monthly total (Number Input, $10,000 to start) and Share evenly. Four cells on shared hairlines each hold a Slider (Infrastructure, Marketing, Tools and Team) that stops when nothing more is unassigned, so the four can never add up to more than the total. A share bar splits the total by largest remainder, so the percents always add to 100, with the unassigned part hatched beside a sliding figure. The one Shine Button is Set budgets, which waits until every dollar is assigned.
FAQ
How are the sliders linked?
Each slider runs from $0 to the total, in $50 steps, but a thumb can't pass what is unassigned: pushing it further leaves it where it stopped. To give one category more, lower another first. The figure beside the bar always says how much is still unassigned.
What happens when I change the total?
A new total takes effect as you type, as long as it is a whole amount up to $1,000,000 and not below what the categories already add up to; otherwise the old total stays and a sentence under the box says why. The sliders' range, the share bar and the percents all follow the total.
Why do the percents always add to 100?
They are worked out by largest remainder: every share is rounded down, and the leftover points go to the shares with the biggest fractions. The unassigned part counts as a share too, so a half-assigned budget still adds to 100.
What stays local in the demo, and how do I wire it?
Everything: Set budgets says "Saved in this demo." and nothing leaves the page. In your app send total and budgets from confirm once nothing is unassigned, and load saved amounts into START. The four categories are typed in CATEGORIES.