Proportional Slider
Split a fixed total across colored segments with draggable dividers.
Playground
Open Show controls to change the segment count, step and minimum, and to try read only and disabled.
Default
Drag a divider to move share between its two neighbours; the total stays fixed. onValuePreview reports live values while dragging and null on release.
Segment count
n segments get n − 1 dividers. Past about ten segments, a table of values is easier to read.
Minimum value
By default a segment stops at the value that keeps it minSegmentWidth (8px) wide. Pass minSegmentValue for an explicit floor of 0 or 1.
Total and step
total sets what the segments add up to (default 100) and step sets the increment (default 1).
Support line 30 · Sales 20 · Collections 10 of 60 slots
Read only
readOnly draws the split without dividers or handles, for showing a breakdown.
Disabled
disabled keeps the dividers visible but dims the track and ignores input.
External inputs
Pair the slider with number inputs. Keep a draft while a field has focus and commit it on blur with setSegmentValue, which keeps earlier segments fixed and rebalances the ones after it. Pass strategy: "proportional" to scale all the others instead.
Best practices
When to use
- Use to split a fixed total across a few named parts, such as a traffic split between voices or concurrent call slots between agents.
- Use separate inputs or a table past about ten segments, or when every value must be exact.
Behavior
- Dragging a divider moves share only between its two neighbours; the total never changes.
- Show the values beside the bar. Use onValuePreview for live numbers while dragging; it reports null on release.
- Set total and step to the real unit, like total={60} step={5} for call slots.
- Pair inputs by keeping a draft on focus and committing on blur with setSegmentValue. The default suffix strategy keeps earlier segments fixed; strategy: "proportional" scales all the others.
- Use readOnly to display a breakdown and disabled when the split is locked.
Content
- Give every segment a label and a distinct 400-level colour; the label is its accessible name.
Accessibility
- Each divider is keyboard adjustable and named from its two neighbours; do not rely on colour alone to tell segments apart.