Developer Programs

Learn

Docs

Slider

Components > Editing Data > Slider
Use this component to...
Allow the user to specify a numeric value by sliding a button along a track

Overview

Use the slider component to prompt the user for a numeric value by allowing them to slide a button along a track. The slider can make it easier for the user to select one of a small set of possible values, without having to type it.

Slider example
When to use the slider

Only use a slider if the input is numeric and the set of possible input values is small.

For example, you would not use a slider to prompt for a rate input that allows any value from 0.000 to 100.000, as that’s a total of 100,101 separate values that can be entered. You would use a numeric input for that case; a slider doesn’t allow for values that fine grained.


Development

Web component development

Component reference

slider
slider

Specify a discrete numeric value by dragging a slider

View the slider reference doc

Implementation

To implement a slider, use <input type="range" />. Each browser displays this very differently, so we have re-skinned the component using CSS so it looks the same in all supported browsers.

Specify the min and max values. In an Angular application, two-way bind ngModel to the underlying number value in your view component.

Slider HTML
<input type="range" min="1" max="20" [(ngModel)]="volumeLevel" />

Angular component development

Component reference

slider
slider

Specify a discrete numeric value by dragging a slider

View the slider reference doc

Implementation

To implement a slider, use <input type="range" />. Each browser displays this very differently, so we have re-skinned the component using CSS so it looks the same in all supported browsers.

Specify the min and max values. In an Angular application, two-way bind ngModel to the underlying number value in your view component.

Slider HTML
<input type="range" min="1" max="20" [(ngModel)]="volumeLevel" />

Design

Figma design

Figma design info
You can find this component in the Components - Forms page in the Figma UI Kit.
Dev ComponentDesign Component Name
Slider ThumbRUI / Forms / Slider Thumb
Slider TrackRUI / Forms / Slider Track

Add a slider track to your artboard. Resize its width appropriately. Do not change its height.

Then add a slider thumb above the slider track. Position the thumb where you want it to appear horizontally.

Vertically center the thumb and the track.


Adobe XD design

Adobe XD design info
You can find this component in these artboards in the Adobe XD design samples:
  • Sample App - Slider
Dev ComponentDesign Component Name
Slider ThumbJHA / Forms / Slider Thumb
Slider TrackJHA / Forms / Slider Track

Add a slider track to your artboard. Resize its width appropriately. Do not change its height.

Then add a slider thumb above the slider track. Position the thumb where you want it to appear horizontally.

Vertically center the thumb and the track.


Support options
Have questions on this topic?
Join the Responsive UI team in Microsoft Teams to connect with the community.
See something in this page that needs to change?
Send us feedback on this page.
Last updated Tue Apr 18 2023