Range Slider

Updated at:

Introduction

The range slider is a basic Magic Pen component that allows users to select a range between two values by dragging the slider.

Configurations

Category

Configuration

Example

Description

Content

Start value

The start value.

End value

The end value.

Minimum value

The minimum value of the range.

Maximum value

The maximum value of the range.

Label

The label. For more information, see Common Form Properties.

Tooltip

The tooltip settings that appear when the mouse hovers over the slider.

Interaction

Hide

Hides the component. For more information, see Common Properties.

Keep layout when hidden

Keeps the layout space when the component is hidden. For more information, see Common Properties.

Step size

The step value for the slider.

Draggable range

The entire selected range can be dragged.

Disable

Disables the component. When disabled, the component is not interactive.

Style

Margin

The margin. For more information, see Common Properties.

Tick marks

image

The tick marks. The key must be a number within the closed interval of [min, max]. You can set the style for each label individually. For more information, see Slider API.

Reverse axis

Reverses the slider, swapping the left and right ends.

CSS Style

Label font size

Sets the font size of the label.

Left margin

Sets the left margin.

Right margin

Sets the right margin.

Properties and methods

Name

Type

Example

Description

start

number

rangeslider.start

The start value of the range slider component.

end

number

rangeslider.end

The end value of the range slider component.

labelText

string

rangeslider.labelText

Read-only. The text content of the slider component's label.

disabled

boolean

rangeslider.disabled

Indicates whether the slider component is disabled.

max

number

rangeslider.max

Read-only. The maximum value of the slider component's range.

min

number

rangeslider.min

Read-only. The minimum value of the slider component's range.

marks

object

rangeslider.marks

Read-only. The tick marks of the slider component.

reverse

boolean

rangeslider.reverse

Read-only. Indicates whether the slider component's axis is reversed.

step

number

rangeslider.step

Read-only. The step size of the slider component.

draggableTrack

boolean

rangeslider.draggableTrack

Read-only. Indicates whether the range of the range slider component is draggable.

validationMessage

string

rangeslider.validationMessage

The validation result message.

validationStatus

boolean

rangeslider.validationStatus

Indicates whether the component passed validation.

setStart

func

rangeslider.setStart(2)

Sets the start value of the range slider component.

setEnd

func

rangeslider.setEnd(9)

Sets the end value of the range slider component.

setDisabled

func

rangeslider.setDisabled(true)

Sets whether the slider component is disabled.

focus

func

rangeslider.focus()

Sets focus on the component.

blur

func

rangeslider.blur()

Removes focus from the component.

clearValidate

func

rangeslider.clearValidate()

Clears the validation status.

validate

func

rangeslider.validate()

Validates the component.

Event callbacks

Configuration

Description

The callback triggered when the value changes.

The callback triggered when the slider receives focus.

The callback triggered when the slider loses focus.