Skip to content

Slider

A slider built on an enhanced native <input type="range">.

Basic Usage

Basic usage

Range & Step

min / max / step

Disabled

Disabled

Marks (object)

Marks object: value → label map

Marks (array)

Marks array: values only, labels fall back to the numeric text

While dragging, tick marks and labels reached by the current value are highlighted with the theme color. marks supports both a JSON object {"值":"标签"} and a JSON array [值, 值] (array elements may also be {"value": 26, "label": "26°C"}).

Events

Live value & change events

oas-input fires while dragging, oas-change fires on release; both detail.value are numbers:

API

Attributes

AttributeDescriptionTypeDefault
disabledDisabledboolean
marksTicks: JSON object {"0":"0°C"} (value→label) or JSON array [0,26,60] (also {"value":26,"label":"26°C"}); tick marks and labels are shown below the track, highlighted where the value passesstring | Record<string, string | number> | number[]
maxRangestring100
minRangestring0
stepStepstring1
valueCurrent value (controlled)string

Events

EventDescription
oas-changeCommitted on release, detail: { value }
oas-inputWhile dragging, detail: { value }