Skip to content

Slider ​

Draggable value track. on_input fires per tick; on_commit fires once on release so expensive reactions don't fan out.

Examples ​

With value ​

moonbit
@sumi.slider(
  value=current,
  show_value=true,
  suffix="°",
  on_input=set_strength.map(v => _ => v),
)

Value bubble ​

moonbit
@sumi.slider(
  value=current,
  value_tooltip=true,
  on_input=set_amount.map(v => _ => v),
)

API ​

slider ​

NameTypeDefaultDescription
value *Int—Current value (controlled)
minInt0Lower bound
maxInt100Upper bound
stepInt1Tick size
on_inputEmit[Int]—Called on every input
on_commitEmit[Int]—Called once on release
disabledBoolfalseBlocks interaction and dims the control
show_valueBoolfalseRight-aligned numeric readout
value_tooltipBoolfalseBubble above the thumb while interacting
suffixString""Unit appended to the readout
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

* required (labelled) parameter — everything else is optional.