Slider

Slider UI component is used to set value by sliding a thumb (handle) horizontally or vertically. Slider works only with integer numbers, so decimal places will not work.

Constructor

new Slider(textopt)

Slider constructor. Creates an instance of Slider UI component.

Parameters:
NameTypeAttributesDescription
textstring<optional>

Text of the component.

Classes

Slider

Members

(readonly) isAdjusting :boolean

Indicates if the slider handle is being moved at that moment and not released yet.

Type:
  • boolean

Methods

emitWhileSliding(enabledopt) → {Slider|boolean}

Enables or disables onChange event to be continuously emitted while user is moving the handle and value is changing. If disabled, the onChange event will only be invoked after user stopped sliding the knob and releases mouse button.

Parameters:
NameTypeAttributesDescription
enabledboolean<optional>

If true, change events are emitted during sliding; if false, only when handle is released.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

inverted(invertedopt) → {Slider|boolean}

Sets or gets whether the Slider is inverted (maximum value on the left/top).

Parameters:
NameTypeAttributesDescription
invertedboolean<optional>

If true, the maximum value is on the left/top; if false, it is on the right/bottom.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

majorTickSpacing(spacingopt) → {Slider|number}

Sets or gets the spacing between major tick marks (larger markings) in the Slider.

Parameters:
NameTypeAttributesDescription
spacingnumber<optional>

The interval at which major tick marks are drawn.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | number

max(maxValueopt) → {Slider|number}

Sets or gets the maximum value of the Slider.

Parameters:
NameTypeAttributesDescription
maxValuenumber<optional>

The maximum allowed value.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | number

min(minValueopt) → {Slider|number}

Sets or gets the minimum value of the Slider.

Parameters:
NameTypeAttributesDescription
minValuenumber<optional>

The minimum allowed value.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | number

minorTickSpacing(spacingopt) → {Slider|number}

Sets or gets the spacing between minor tick marks (smaller markings) in the Slider.

Parameters:
NameTypeAttributesDescription
spacingnumber<optional>

The interval at which minor tick marks are drawn.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | number

orientation(orientationopt) → {Slider|Orientation}

Sets or gets the orientation of the Slider.

Parameters:
NameTypeAttributesDescription
orientationOrientation<optional>

The slider's orientation: Orientation.Horizontal or Orientation.Vertical.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | Orientation

showLabels(visibleopt) → {Slider|boolean}

Shows or hides numeric labels on the Slider.

Parameters:
NameTypeAttributesDescription
visibleboolean<optional>

If true, labels will be displayed; if false, they will be hidden.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

showTicks(visibleopt) → {Slider|boolean}

Shows or hides tick marks on the Slider.

Parameters:
NameTypeAttributesDescription
visibleboolean<optional>

If true, tick marks will be displayed; if false, they will be hidden.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

showTrack(visibleopt) → {Slider|boolean}

Shows or hides the track (line) behind the slider knob.

Parameters:
NameTypeAttributesDescription
visibleboolean<optional>

If true, the track will be displayed; if false, it will be hidden.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

snapToTicks(snapopt) → {Slider|boolean}

Enables or disables snapping the slider's knob to the nearest tick mark.

Parameters:
NameTypeAttributesDescription
snapboolean<optional>

If true, the knob will snap to the nearest tick; if false, it moves freely.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | boolean

value(valueopt) → {Slider|number}

Sets or get integer value of the slider.

Parameters:
NameTypeAttributesDescription
valuenumber<optional>

Value to display by the slider's handle. Must be between min and max allowed values.

Returns:

When setting a value, returns this component for chaining; otherwise returns the current value.

Type: 
Slider | number