Stretch Slider
A range slider whose track thickens when active, stretches like rubber when pulled past an end and wobbles back. Icons, ticks, a handle, a value bubble and a vertical layout are options.
pixikit.com/docs/components/stretch-slider
Customize
Is stepped
Step size10
Orientation
Icon placement
Value position
Ticks
Thumb
Fill from0
Thickness6px
Active thickness12px
Radius40px
Rest opacity0.70
Grow on hover
Max stretch50px
Bounce0.50
Jump to click
Wheel
Range color
Props
36| Name | Type | Default | Description |
|---|---|---|---|
value | number | None | Controlled value. Pair it with onChange. |
defaultValue | number | 50 | Starting value when uncontrolled. |
startingValue | number | 0 | Lowest value of the range. |
maxValue | number | 100 | Highest value of the range. |
isStepped | boolean | false | Snaps the value to stepSize increments. |
stepSize | number | 1 | Size of each step when isStepped is on. |
onChange | (value: number) => void | None | Called as the value changes. |
onChangeEnd | (value: number) => void | None | Called when a drag, key press or scroll finishes. |
orientation | "horizontal" | "vertical" | "horizontal" | Direction of the track. Vertical sliders fill from the bottom. |
leftIcon | ReactNode | QUIET | Icon at the start of the track. Pass null to hide it. |
rightIcon | ReactNode | LOUD | Icon at the end of the track. Pass null to hide it. |
iconPlacement | "outside" | "inside" | "outside" | Puts the icons beside the track, or inside it once the track is thick enough to hold them. |
valuePosition | "top" | "bubble" | "inside" | "none" | "top" | Where the value shows. Bubble rides above the fill while the slider is active. |
formatValue | (value: number) => string | None | Formats the shown value and the value read by screen readers. |
ticks | boolean | number[] | false | Marks along the track. True marks every step, or every tenth when not stepped. An array marks those values. |
thumb | boolean | false | Shows a round handle at the end of the fill. |
fillFrom | number | None | Value the fill grows from. Set it to the middle of the range for a centered, two-way fill. |
thickness | number | 6 | Track thickness in px at rest. |
activeThickness | number | 12 | Track thickness in px while hovered, focused or dragged. |
radius | number | None | Corner radius of the track in px. Fully round when left out. |
restOpacity | number | 0.7 | Opacity while idle. The slider brightens to full when active. |
growOnHover | boolean | true | Hovering activates the slider. When off it only grows while pressed or focused. |
maxStretch | number | 50 | Furthest the track stretches in px when pulled past an end. 0 turns the stretch off. |
bounce | number | 0.5 | How much the track wobbles as it springs back, from 0 to 0.95. |
jumpToClick | boolean | true | Pressing the track jumps to the pointer. When off, dragging moves the value from where it was. |
wheel | boolean | false | Lets the scroll wheel change the value. |
trackColor | string | "color-mix(in srgb, currentColor 18%, transparent)" | Color of the empty track. |
rangeColor | string | "currentColor" | Color of the fill. |
iconColor | string | "currentColor" | Color of the outside icons. |
contentColor | string | "currentColor" | Color of icons, values and ticks over the empty track. |
fillContentColor | string | "auto" | Color of icons, values and ticks over the fill. Auto picks light or dark from the fill color. |
thumbColor | string | "#ffffff" | Color of the handle. |
disabled | boolean | false | Turns off interaction and dims the slider. |
ariaLabel | string | "Slider" | Accessible name of the slider. |
className | string | "" | |
style | CSSProperties | None |