Rubber sliderPro
A slider that stretches like rubber past its ends and springs back, pushing its icons outward, with a value tag that sways with the thumb's speed and detents it clicks into.
oxyn add rubber-sliderThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- A slider that stretches like rubber past its ends: the track widens (and shifts for the start end) by rubber(over, 22) and the start / end icons are pushed outward by 60 % of that, then everything springs back on release.
- The thumb swells to 1.28× while dragged; a value tag rides over it and tilts with its speed (tag_tilt, ±14°).
- Detents (marks) catch a dragged thumb within 7 px and hold it there (detent); a detent's tick pops when the thumb clicks in.
- Labelled marks print under the track and are clickable.
When not to use
- On or off for things that apply right away: use Switch instead.
- A real checkbox with a label and second line, an indeterminate state for Select all, an error, a card row and a check that draws itself: use Checkbox instead.
- Pick one: use Radio group instead.
Installation
Rubber slider is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add rubber-sliderUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Detents
Detents the thumb clicks into; labels can be clicked.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Plain
No marks: just the rubber band and the swaying tag.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Bare
No icons or readout.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
RubberSlider
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | String | — | Label. |
value | f64 | Default::default() | Starting value. |
min | f64 | Default::default() | Lowest value. |
max | f64 | 100.0 | Highest value. |
step | f64 | 1.0 | Step. |
marks | Vec<(f64, String)> | Default::default() | Detents: value and label (empty for an unlabelled tick). Labelled ones can be clicked. |
suffix | String | Default::default() | Text after the value ("%"). |
show_value | bool | true | Show the value beside the label. |
start_icon | Option<String> | Default::default() | Icon before the track. |
end_icon | Option<String> | Default::default() | Icon after the track. |
disabled | bool | Default::default() | Disabled. |
on_change | EventHandler<f64> | — | Every change. |
on_commit | EventHandler<f64> | — | Once a drag ends, a key lands or a mark is clicked. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| ←or→or↑or↓ | One step |
| ShiftarrowsorPage UporDown | A tenth of the range |
| HomeorEnd | Min / max; at a limit the track stretches toward the press |
Accessibility
- The thumb is role=slider with a formatted aria-valuetext.
- Reduced motion removes the stretch, sway and tick pop.
From the spec
- The thumb is role=slider with aria-valuetext; disabled removes it from the tab order.
Motion & interaction
Timing
- Spring back 450 ms (cubic-bezier .3,1.5,.5,1); thumb swell 180 ms; tag sway 350 ms.
- Reduced motion removes the stretch, sway and tick pop; the thumb jumps and the tag fades.
Responsive behaviour
- The track fills its container; icons stay at the ends.
Edge cases (spec)
- The track fills its row between the icons.
Notes for AI
- Import
RubberSliderfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
RubberSliderElinoxyn_gpui. - Props to set first:
label. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.