Skip to content

Slider Field ​

A labelled numeric field composing the slider with tick marks and labels plus a number box with unit suffix; an optional auto row adds a switch.

Examples ​

Ticks & number box ​

moonbit
@sumi.slider_field(
  value=current,
  min=0,
  max=180,
  label="Clip length",
  unit="s",
  ticks=[0, 30, 60, 90, 120, 150, 180],
  auto=is_auto,
  on_auto_change=set_auto.map(v => _ => v),
  on_input=set_length.map(v => _ => v),
)

API ​

slider_field ​

NameTypeDefaultDescription
value *Int—Current value (controlled)
minInt0
maxInt100
stepInt1
labelString—Title above the track; also the number-box aria label
unitString""Suffix inside the number box
ticksArray[Int][]Values getting a track mark and a label
autoBool—Shows the auto row with a switch when given
auto_labelString"Auto"
on_auto_changeEmit[Bool]—
on_inputEmit[Int]—Per-tick during drags and number commits
on_commitEmit[Int]—On release and number commits
disabledBoolfalseBlocks interaction and dims the control
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

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