Skip to content

Sliders are used to set linear values while providing intuitive visual feedback.

Overview

Sliders allow users to view a selected value, or range of information. Sliders provide a visual indicator, or handle of the current value, which is adjustable. This allows the user to increase or decrease the value(s) by moving the Slider's handle along a horizontal track.

Configurable properties support the ability to add ticks, labels with labelTicks, precision handles with precise, and a histogram with hasHistogram.

Usage

  • When offering the user a numeric adjustable value or range
  • Adjusting a buffer area
  • Opacity or transparency control
  • Volume control
  • Adjusting or setting a map extent
  • A video timeline

Sample

Accessibility

Slider should be accompanied by a Label, which provides context of the intent to support assistive technologies.

Keyboard navigation

KeyFunction
Arrow leftReduces the component's value by the step (default value is "1").
Arrow rightIncrements the component's value by the step (default value is "1").
Arrow downReduces the component's value by the step (default value is "1").
Arrow upIncrements the component's value by the step (default value is "1").
TabMoves focus in and out of the component. For range values where minValue and maxValue are set and the currently focused item is the minimum value, focus will proceed to the maximum value.
Tab and ShiftMoves focus in and out of the component. For range values where minValue and maxValue are set and the currently focused item is the maximum value, focus will proceed to the minimum value.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
disableddisabledWhen true, interaction is prevented and the component is displayed with lower opacity.booleanfalse
fillPlacementfill-placementWhen value is specified for single values, determines the track's fill relative to the component's handle. When minValue and maxValue are specified for multiple values, displays the fill between the minValue and maxValue handles."start" | "none" | "end""start"
formformSpecifies the id of the component's associated form. When not set, the component is associated with its ancestor form element, if one exists.string
groupSeparatorgroup-separatorWhen true, number values are displayed with a group separator corresponding to the language and country format.booleanfalse
hasHistogramhas-histogramWhen true, indicates a histogram is present.booleanfalse
histogramSpecifies a list of the histogram's x,y coordinates within the component's min and max. Displays above the component's track.DataSeries
histogramStopsSpecifies a list of single color stops for a histogram, sorted by offset in ascending order.ColorStop[]
labelFormatterWhen specified, allows users to customize handle labels.(value: number, type: "value" | "min" | "max" | "tick", defaultFormatter: (value: number) => string) => string | undefined
labelHandleslabel-handlesWhen true, displays numeric value labels on handles.booleanfalse
labelTextlabel-textSpecifies the component's label text.string
labelTickslabel-ticksWhen true and ticks is specified, displays label tick marks with their numeric value.booleanfalse
maxmaxThe component's maximum selectable value.number100
maxLabelmax-labelWhen minValue and maxValue are specified for multiple values, specifies the accessible name for the maxValue handle, such as "Temperature, upper bound".string
maxValuemax-valueFor multiple values, specifies the component's upper value.number
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
minminSpecifies the component's minimum selectable value.number0
minLabelmin-labelSpecifies the accessible name associated with the value handle (for single values) or minValue handle (for multiple values). For instance, "Temperature, lower bound".string
minValuemin-valueFor multiple values, the component's lower value.number
mirroredmirroredWhen true, the component will display values from high to low. Note that this value will be ignored if the slider has an associated histogram.booleanfalse
namenameSpecifies the name of the component. Required to pass the component's value on form submissionstring
numberingSystemnumbering-systemSpecifies the Unicode numeral system used by the component for localization.NumberingSystem
pageSteppage-stepSpecifies the interval to move with the Page up or Page down keys.number
precisepreciseWhen true, sets a finer point for handles.booleanfalse
requiredrequiredWhen true and the component resides in a form, the component must have a value in order for the form to submit.booleanfalse
scalescaleSpecifies the component's size.Scale"m"
snapsnapWhen true and step is specified, enables snap selection via a mouse.booleanfalse
statusstatusSpecifies the status of the input field, which determines message and icons.Status"idle"
stepstepSpecifies the interval to move with the Arrow up or Arrow down keys.number1
ticksticksSpecifies the interval between tick marks on the number line.number
validationIconvalidation-iconSpecifies the validation icon to display under the component.IconName | boolean
validationMessagevalidation-messageSpecifies the validation message to display under the component.string
validityread-onlyThe component's current validation state.MutableValidityState
valuevalueThe component's value.number | number[]

Styles

NameDescription
--calcite-slider-text-colorSpecifies the component's text color.
--calcite-slider-track-colorSpecifies the component's track color.
--calcite-slider-track-fill-colorSpecifies the component's track fill color.
--calcite-slider-handle-fill-colorSpecifies the component's handle fill color.
--calcite-slider-handle-extension-colorSpecifies the component's handle extension color.
--calcite-slider-accent-colorSpecifies the component's accent color.
--calcite-slider-tick-colorSpecifies the component's tick color.
--calcite-slider-tick-border-colorSpecifies the component's tick border color.
--calcite-slider-tick-selected-colorSpecifies the component's tick color when in selected range.
--calcite-slider-graph-colorSpecifies the component's graph color.

Events

NameDescriptionBehavior
calciteSliderChangeFires when the component's handle is released. Note: To constantly listen to the drag event, use calciteSliderInput instead.bubblescomposed
calciteSliderInputFires on all updates to the component. Note: Fires frequently during drag. To perform expensive operations consider using a debounce or throttle to avoid locking up the main thread.bubblescomposed

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.