CxJS

Slider

import { Slider } from 'cx/widgets'; Copied

The Slider widget allows selecting numerical values by dragging the slider handle. It supports single values, ranges, stepping, mouse wheel control, and vertical orientation.

<div class="flex gap-8">
  <LabelsLeftLayout>
    <Slider
      label="Standard"
      value={bind(m.value, 50)}
      wheel
      valueTooltip={{ text: format(m.value, "n;0"), placement: "up" }}
    />
    <Slider label="Stepped" value={bind(m.stepped, 50)} step={10} wheel />
    <Slider label="Range" from={bind(m.from, 25)} to={bind(m.to, 75)} />
    <Slider label="Disabled" value={50} disabled />
  </LabelsLeftLayout>
  <Slider
    vertical
    from={bind(m.from, 25)}
    to={bind(m.to, 75)}
    rangeStyle="background: lightsteelblue"
  />
</div>
 
 
 
 
 

Configuration

Value Properties

PropertyTypeDefaultDescription
valuenumberSingle value (alias for to)
fromnumberLow value for range slider
tonumberHigh value for range slider
minValuenumber0Minimum allowed value
maxValuenumber100Maximum allowed value
stepnumberRounding step for discrete values

Behavior

PropertyTypeDefaultDescription
wheelbooleanfalseEnable mouse wheel control (not with range sliders)
incrementnumber1%Value change per wheel tick
disabledbooleanfalseDisable the slider
verticalbooleanfalseOrient the slider vertically
invertbooleanfalseInvert vertical slider (top to bottom)

Appearance

PropertyTypeDescription
handleStylestring/objectCSS style for the slider handle
rangeStylestring/objectCSS style for the selected range

Tooltips

PropertyTypeDescription
valueTooltipstring/objectTooltip config for the value handle
fromTooltipstring/objectTooltip config for the from handle
toTooltipstring/objectTooltip config for the to handle