With Value Display
showValue prints the number opposite the label.
<div style={{ width: '300px' }}>
<Slider
label="Brightness"
defaultValue={75}
showValue
valueSuffix="%"Selects a numeric value within a defined range.
import { Slider } from "@/fragments/ui";Source<div style={{ width: '300px' }}>
<Slider label="Volume" defaultValue={50} />
</div>npx @usefragments/cli add sliderWrites src/fragments/ui/components/Slider plus what it imports, the globals stylesheet, and .fragments/registry-lock.json, then prints the packages to add. No account, no key.
Your own registry: publish from Fragments Cloud and add --registry org/name. Connect a workspace.
showValue prints the number opposite the label.
<div style={{ width: '300px' }}>
<Slider
label="Brightness"
defaultValue={75}
showValue
valueSuffix="%"min, max and step bound the track to real-world units.
<div style={{ width: '300px', display: 'flex', flexDirection: 'column', gap: '16px' }}>
<Slider
label="Temperature"
min={60}
max={80}
step={1}The parent owns the value and can react to every move.
<ControlledSliderDemo />The number floats above the thumb only while dragging.
<div style={{ width: '300px' }}>
<Slider
label="Mix"
defaultValue={40}
showValueOnDrag
valueSuffix="%"A line below the track explains the trade-off.
<div style={{ width: '300px' }}>
<Slider
label="Quality"
defaultValue={80}
showValue
valueSuffix="%"Dimmed; the thumb will not move.
<div style={{ width: '300px' }}>
<Slider
label="Locked Setting"
defaultValue={30}
showValue
disabledProp | Type | Default | Description |
|---|---|---|---|
label | string | Not set | Label text |
helperText | string | Not set | Helper text shown below the slider |
error | boolean | false | Show error styling |
value | number | Not set | Controlled value |
defaultValue | number | Not set | Default value for uncontrolled usage |
onChange | function | Not set | Called with new value when changed |
onValueChange | function | Not set | Alias for onChange (Radix convention): (value: number) => void |
min | number | 0 | Minimum value |
max | number | 100 | Maximum value |
step | number | 1 | Step interval |
showValue | boolean | false | Display current value |
showValueOnDrag | boolean | false | Show current value in a floating bubble while dragging the thumb |
valueSuffix | string | | Suffix after value (e.g., "%", "px") |
disabled | boolean | false | Disable the slider |
name | string | Not set | — |
aria-label | string | Not set | Accessible label when visible label is omitted |
aria-labelledby | string | Not set | Accessible labelled-by relationship |
aria-describedby | string | Not set | Accessible described-by relationship |
id | string | Not set | — |
form | string | Not set | ID of the form that owns the hidden slider input |
largeStep | number | Not set | Larger step used for Page Up/Page Down and shift-arrow keyboard input |
onValueCommitted | function | Not set | Callback when the user commits a slider value |
thumbAlignment | enumcenteredgeedge-client-only | Not set | How the thumb is aligned at the minimum and maximum edges |