Components/Forms/Slider
COMPONENT16.16

Slider

Drag slider for single values, ranges and multi-thumbs — native range input for simple cases, <mo-slider> for the rest.


INSTALL

1pnpm dlx @sayagodev/mo add slider

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/slider.css";2import "@sayagodev/mo/js/slider.js";

EXAMPLES

Default (native)
75
Range (2 thumbs)
25 · 75
Multiple thumbs
20 · 50 · 80
Vertical
50
20 · 80
Vertical Adjust with arrows or drag
Controlled
50
Set slider.value = [75] or listen to input events.
Disabled

USAGE

1<mo-slider min="0" max="100" value="50"></mo-slider>2<mo-slider min="0" max="100" value="25,75"></mo-slider> <!-- range -->3<mo-slider orientation="vertical" min="0" max="100" value="50"></mo-slider>4 5<!-- native fallback for single thumb -->6<input type="range" min="0" max="100" value="50" />

API

NAMEKINDDESCRIPTION
<mo-slider>elementRange slider; value is comma-separated, emits input/change
valueattributeComma-separated numbers, e.g. "25,75"
min / max / stepattributeBounds (defaults 0/100/1)
orientationattributehorizontal (default) · vertical
disabledattributeOpacity 0.5, no pointer events
input[type=range]elementNative fallback: full-width track, primary thumb
--mo-range-* / --bar-heighttokenTrack/thumb color hooks

FILES

src/css/slider.csssrc/js/slider.js
Install:mo add slider

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--muted-foreground--primary--radius--ring
Component hooks
--mo-slider-thumb-bg--mo-slider-vertical-height

Preview

64

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.