BoldSlider
Pick a single value on a filled track that shows its label and value inline.
Anatomy#
Usage#
Use BoldSlider for dense settings such as inspector panels and animation controls, where each row holds one number and the track doubles as its readout. Use Slider for ranges, vertical layouts, or a thin track with a visible thumb.
BoldSlider is built on Slider, so value, defaultValue, onValueChange, onValueCommit, min,
max, step, markers, reversed, form props, keyboard interaction, and translations behave the
same way. The value is always a single number; BoldSlider has no range or multi-thumb mode. size
accepts sm, md (default), or lg.
Label and value#
label is drawn at the start of the track; a string label is also the default aria-label. The
value is drawn at the end; set valueLabel={false} to hide it. By default the value is rounded to
the decimal places of step (two places without step) and has no digit grouping. Set
formatOptions to format it with Intl.NumberFormat instead. Pass a function to valueLabel to add
units or other formatting. It receives { percent, value, max }, the same shape as Progress
valueLabel. percent is the filled share of the track from 0 to 100, and max is 100 when unset.
Both texts are drawn twice: once over the track and once clipped to the filled range. Each part of
the text uses the colors of the surface behind it, so it stays readable while the fill passes
through it. Pass a JSX label inline rather than as a shared node, so each layer gets its own copy.
Variants#
The default variant="subtle" uses a solid neutral fill, like the controls in an inspector panel.
The label, value, and indicator keep the same colors over the fill and the track. Set
variant="solid" for a primary-colored fill; the label, value, and indicator then switch to
primary-foreground where the fill passes under them.
Step and markers#
Set step to snap pointer and keyboard input to increments. Without step, pointer movement is
continuous and arrow keys move by 1% of the range. Set markers to true to draw a tick at each
step (this requires a step greater than 0), or to a number to draw a tick every that many units
without changing how the value snaps. Ticks use muted-foreground, so they stay visible in light
and dark themes.
Indicator#
The indicator is a capsule just inside the edge of the fill. When the value is 0, the fill is hidden
and the indicator rests at the minimum-fill position as a drag anchor. Once the value is greater than
0, the fill appears and the indicator sits just inside its edge. Where it sits on the fill it uses
--bs-indicator-fill, and where it sits on the track it uses --bs-indicator-track, so its color
follows the surface behind it. It stays dim and shorter at rest, and brightens to full size while
the track is hovered, the slider is dragged, or the thumb has keyboard focus. Clicking the track
focuses the thumb without the keyboard focus ring.
These states use peer-* selectors on the track and thumb, so each slider reacts only to its own
interaction, even inside a parent with a group class.
Examples#
Tune animation settings#
Stack several sliders to build a compact control panel.
Show a unit with the value#
Use valueLabel to append a unit.
Map steps to preset names#
valueLabel can return any string, so snapped steps can read as names instead of numbers.
Bind brightness to a form#
Place the slider in form.Field so the schema owns the committed number.
API Reference#
Attributes#
data-fillProps#
Props for the BoldSlider component. Renders a <div> element by default.