Skip to main content

Range

Range slider form control. Reach for a range when a user picks a numeric value from a continuous or stepped scale where approximate selection is acceptable.

Usage​

When to use

  • Volume, brightness, or other continuous scales
  • Picking an approximate numeric value within a known range
  • Filters where rough selection is good enough

When not to use

  • Precise numeric input - use a number input
  • Picking from a small set of named options - use a radio
  • Values where the minimum and maximum are not known

Do

  • Set sensible min, max, and step attributes
  • Pair with a visible current value if precision matters
  • Associate the range with a <label>

Don't

  • Use a range for inputs that require exact typed values
  • Hide the current value when precision matters

API​

Slots​

SlotRequiredDescription
labelYesVisible label text for the range input.

Props​

PropTypeDefaultDescription
namestring-Name attribute for the input element.
idstring-HTML id of the input. Used to associate the label.
valuenumber-Current value of the range input.
minnumber-Minimum allowed value.
maxnumber-Maximum allowed value.
stepnumber-Increment step between values.
is_disabledboolean-Renders the disabled attribute on the input.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.

Examples​

Sizes​

Sm, default, and lg variants stacked vertically. Track and thumb scale together.

With value​

A slider starting at an authored value rather than the midpoint of its range.

With min max step​

min, max and step set together, so the thumb moves in fixed increments across a bounded range.

Disabled​

The disabled state, which mutes the track and thumb and drops the control out of the tab order.

Accessibility​

  • WCAG 2.2 AA
  • Native <input type="range"> semantics preserved
  • min, max, step attributes supported
  • Label association via <label> element
  • Visible focus ring on the thumb
  • textfield, number - text and numeric inputs for precise values
  • radio - selection from a small set of options