Skip to content

BbSlider

Choose an approximate bounded value, paired with exact entry when precision matters.

import { BbSlider } from 'bitboss-ui';

On this page

Use it for

Use BbSlider when position within a known interval carries meaning.

Use something else when

Also see: Validated forms.

Passthrough

Hover or tap a part to outline it. The toggles turn on loading, errors and warnings where the component has them; only parts get a row.

Guidance while the control is focused.

Set an exact spending limit

When the amount has consequences, bind the slider and number field to the same ref.

/ month

min, max, and step are hard invariants. Invalid bounds or a non-positive step throw at mount. A value from an API must be converted to a number before binding.

Filter a range

Set range and bind a two-element array; the component keeps it sorted.

Price €100 to €500
17 of 26 products

The model's shape follows the mode: a number for one thumb, a two-element array with range. Binding a number to a range slider throws.

Readout, ticks, and keyboard

The component has no built-in numeric readout. Show the model beside the track or through the thumb slot.

12345

ticks positions the tick slot and draws no marks by itself. Raise max-precision when step is finer than 0.01.

Playback volume Meeting room speaker
60%

Arrow keys move one step, Page keys ten, and Home/End reach the bounds; every key and both stepper callbacks land on the step grid. When max is off that grid, the top is the last grid point (0–10 by 3 stops at 9). The stepper callbacks work only in single-value mode, and each slot's disabled says when its side would do nothing (at a bound, or on a disabled, readonly or range slider), so the buttons bind it instead of comparing to min and max. Save on inactive when persistence should wait for release.

Coming from v2thumb-translate → disable-thumb-translate

:thumb-translate="false" became disable-thumb-translate with inverted polarity.

Messages and locked values

Say why a value is risky, invalid or locked: warnings for a value you accept with a caveat, errors for one you refuse, description or hint for a lock.

Above 80 the files grow faster than the detail.
Production services need at least two.
Set by your plan. Upgrade to raise it.

Prefer readonly for a locked value that people still need to inspect; disabled removes the thumb from the tab order. label-mode takes outside or inside only (a floating default set for the whole app falls back to outside here, without a warning).

Submit it with a form

In a BbForm the slider joins the form by its name and needs no v-model. Use rules for what min and max cannot say.

08:0012:0016:0020:00

Drag the two ends closer than two hours and submit to see the rule stop the booking. A classic <form> post gets one field per value: window=10&window=14 for a range (name it window[] for Laravel), nothing at all for a null value. A slider that sits in a form without being its data, such as a zoom level, takes formless to stay out of the form's data and validation.

Rail, bar, and ticks

The colours are two locals on pt:box: --accent paints the bar and the thumb's halo, --track-color the rail.

0 1k 2k 3k 4k 5k

pt:track reaches the rail itself, pt:bar the coloured span, and pt:tick:in-range only the marks under that span. --track sets the rail's thickness, --thumb the handle's size, and --r the rounding of the rail and of the box.

In inside label mode the box wears the field look through the same words as the other fields: --bg, --bw, --border-color, --r, --elev, --ring-size with --ring-color, and --px/--py. Its focus ring turns danger or warning with the field's state, so recolour the resting border with pt:box="[--border-color:…]" rather than a border-* utility, which would hide the state.

Coming from v2color → --accent

The v2 color prop is gone: set --accent (and --track-color) on pt:box, as above.