HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Slider

Sliders allow users to make selections from a range of values.

Overview

Sliders reflect a range of values along a bar, from which users may select a single value or a range. They are ideal for adjusting settings such as volume, brightness, or applying image filters.

Sliders can be somewhat difficult to manipulate, so they should be used when an approximate value is good enough. When using sliders, consider the unit. If only whole numbers can be chosen, for example, default the slider to use whole values only.

Usage

forge-slider selects a value — or, with range, a start and end value — along a bounded track through min, max, step, tickmarks, and labeled, and participates in form submission via name. Reserve it for a value that’s fine to be approximate; when a user needs to enter a known, specific number, use a text field instead.

Rules

Do
Use a slider when an approximate value is good enough and dragging gives immediate feedback, like volume or a filter range.Keep the current value's label visible so users aren't guessing where the handle sits.Live-update any dependent results as the handle drags, not just after it's released.Offer a text field alternative alongside a slider when a user might want to enter an exact value.
Don't
Don't use a slider for a binary on/off setting — use a switch instead.Don't use a slider when a user needs to enter a known, specific value — use a text field instead.Don't hide the current value's label unless space is truly constrained.Don't use a slider when the range is very large making it difficult to select specific values accurately.

Range

Set range to render two handles — valueStart and valueEnd — instead of one, for selecting a span rather than a single point.

Two handles select a start and end value instead of a single point.

Tickmarks

Set tickmarks to show marks spaced by step, giving the handle discrete stops to snap to.

Tickmarks spaced by step give the handle discrete stops to snap to.

Disabled and readonly

disabled excludes the slider from the form; readonly keeps it in the form but locks its value.

Disabled excludes the slider from the form; readonly keeps it in the form but locks its value.

Custom labels

Set labelBuilder (or label/labelStart/labelEnd) to caption the handle with something other than a bare number.

A custom label captions the handle instead of a bare number.

Sliders allow users to make selections from a range of values. You can use sliders for selecting values from either a continuous or discrete range, and they can also be used for selecting a single value or a range of values.

import "@tylertech/forge/slider";
Properties
PropertyAttributeTypeDefaultDescription
namenamestring—Controls the form control name.
nameStartname-startstring—Controls the form control name for the start handle in range mode.
nameEndname-endstring—Controls the form control name for the end handle in range mode.
valuevaluenumber50Sets the current value of the slider.
valueStartvalue-startnumber33Sets the current start value of the slider in range mode.
valueEndvalue-endnumber67Sets the current end value of the slider in range mode.
labellabelstring—Sets the label text for the slider handle.
labelStartlabel-startstring—Sets the label text for the start slider handle in range mode.
labelEndlabel-endstring—Sets the label text for the end slider handle in range mode.
labelBuilder—SliderLabelBuilder—A function that returns a label for the slider handle.
minminnumber0Sets the minimum value of the slider.
maxmaxnumber100Sets the maximum value of the slider.
stepstepnumber1Sets the step value of the slider.
tickmarkstickmarksbooleanfalseControls if tickmarks are visible.
labeledlabeledbooleantrueControls if labels are visible.
rangerangebooleanfalseControls range mode.
disableddisabledbooleanfalseControls if the slider is disabled.
readonlyreadonlybooleanfalseControls if the slider is readonly.
—data-aria-labelstring—Sets the `aria-label` attribute on the slider handle.
—data-aria-label-startstring—Sets the `aria-label` attribute on the start handle in range mode.
—data-aria-label-endstring—Sets the `aria-label` attribute on the end handle in range mode.
Events
NameTypeDescription
forge-slider-inputCustomEvent<ISliderChangeEventData>Dispatches when the slider value changes.
forge-slider-changeCustomEvent<ISliderChangeEventData>Dispatches when the slider value changes and the value has been committed.
forge-slider-range-inputCustomEvent<ISliderRangeChangeEventData>Dispatches when the slider range values change.
forge-slider-range-changeCustomEvent<ISliderRangeChangeEventData>Dispatches when the slider range values change and the values have been committed.
CSS Parts
NameDescription
::part(slider)Styles the slider container element.
::part(track)Styles the track element.
::part(handle-end)Styles the end handle element.
::part(handle-end-thumb)Styles the end handle thumb element.
::part(handle-end-label)Styles the end handle label element.
::part(handle-end-label-content)Styles the end handle label content element.
::part(handle-start)Styles the start handle element.
::part(handle-start-thumb)Styles the start handle thumb element.
::part(handle-start-label)Styles the start handle label element.
::part(handle-start-label-content)Styles the start handle label content element.
CSS Custom Properties
NameDescription
--forge-theme-primaryThe primary color of the slider.
--forge-theme-on-primaryThe color of elements placed on top of the primary color (the label text for example).
--forge-slider-track-heightThe height of the track.
--forge-slider-active-track-colorThe color of the active track.
--forge-slider-active-track-heightThe height of the active track.
--forge-slider-active-track-shapeThe shape of the active track.
--forge-slider-disabled-active-track-colorThe color of the active track when disabled.
--forge-slider-disabled-active-track-opacityThe opacity of the active track when disabled.
--forge-slider-disabled-handle-colorThe color of the slider handle when disabled.
--forge-slider-disabled-inactive-track-colorThe color of the inactive track when disabled.
--forge-slider-disabled-inactive-track-opacityThe opacity of the inactive track when disabled.
--forge-slider-focus-handle-colorThe color of the slider handle when focused.
--forge-slider-handle-colorThe color of the slider handle.
--forge-slider-handle-heightThe height of the slider handle.
--forge-slider-handle-widthThe width of the slider handle.
--forge-slider-handle-shapeThe shape of the slider handle.
--forge-slider-hover-handle-colorThe color of the slider handle when hovered.
--forge-slider-inactive-track-colorThe color of the inactive track.
--forge-slider-inactive-track-heightThe height of the inactive track.
--forge-slider-inactive-track-shapeThe shape of the inactive track.
--forge-slider-label-container-shapeThe shape of the label container.
--forge-slider-label-container-colorThe color of the label container.
--forge-slider-label-container-heightThe height of the label container.
--forge-slider-label-text-colorThe color of the label text.
--forge-slider-pressed-handle-colorThe color of the slider handle when pressed.
--forge-slider-state-layer-sizeThe size of the state layer.
--forge-slider-with-overlap-handle-outline-colorThe color of the slider handle outline when overlapping.
--forge-slider-with-overlap-handle-outline-widthThe width of the slider handle outline when overlapping.
--forge-slider-with-tick-marks-active-container-colorThe color of the active tick mark container when tick marks are visible.
--forge-slider-with-tick-marks-container-sizeThe size of the tick mark container when tick marks are visible.
--forge-slider-with-tick-marks-disabled-active-container-colorThe color of the active tick mark container when tick marks are visible and disabled.
--forge-slider-with-tick-marks-disabled-inactive-container-colorThe color of the inactive tick mark container when tick marks are visible and disabled.
--forge-slider-with-tick-marks-inactive-container-colorThe color of the inactive tick mark container when tick marks are visible.

Keyboard interaction

Ensure every slider control is reachable by the tab key and can be adjusted with the left and right arrow keys — for a range slider, that applies to each thumb independently.

Loading Forge chat…