Sliders and number inputs

A slider is useful when the relationship between values matters: quieter or louder, lower or higher. Exact entry becomes useful when a person already knows the number. Compare the volume and price-range examples, then decide how much precision your own interface needs.

Original catalog components. Changes affect this example only.

Interactive demo. No data is sent.

Decide how precise the task is

Think about the question the control answers. Adjusting a preview until it feels right suits a slider. Entering a known budget or measurement may be easier with a number field. Do not make someone repeatedly drag a thumb when they arrived with an exact target. The appropriate control depends on the task, not the available decoration.

A design can offer both interaction methods when precision and exploration matter together. If you add an editable number field, give it a visible label, units, and limits that agree with the slider. The shipped examples here show slider interactions; they do not include a second editable number input or demonstrate synchronization with one.

Make the unit and current value visible

The volume example shows a percentage and a small level visualization. Moving the thumb changes local state and updates the visible value. Try the low end and the high end before inspecting intermediate positions. The percentage is a preview level: this component does not play audio or change the volume of your device.

Keep a readable number beside the track when a useful value can be expressed in text. Otherwise the person must estimate from thumb position alone. Put the unit with the value and keep it consistent across labels, accessible output, and application data. A percentage and a stored audio gain need an explicit conversion in the application.

Name both ends of a selected range

The price example has separate minimum and maximum handles, with a combined value above the track. Try changing each end independently and bringing them together. The controller constrains the lower and upper values so they do not cross. Each handle has its own name, which matters when their visual positions become close.

A range needs a clear domain and step. In this example, the local model uses a bounded dollar range and snapped increments. Those are sample choices rather than a pricing or currency service. If your product needs other units or precision, change the model deliberately and check the labels, formatting, limits, and keyboard increments together.

html
<label for="level">Preview level</label>
<input id="level" type="range"
  min="0" max="100" step="1" value="64">

Keep values reachable without dragging

A person should be able to reach and change a slider with the keyboard. The volume component is based on a native range input. The custom price handles support arrow keys and endpoints, with larger steps available through PageUp and PageDown. Try each handle in turn and confirm that its visible value follows its focus.

Also check touch behavior on an actual device and with the assistive technology your audience uses. A custom multi-handle control has more interaction work than its appearance suggests. Keep the active handle distinguishable and prevent labels from colliding at narrow widths. A pointer-only recording cannot establish that an exact value is reachable for everyone.

Connect values to the real application

The examples change local preview values only. They do not persist a preference or filter a product catalog. In your application, decide whether dragging updates a preview immediately, waits for release, or waits for an Apply action. Keep expensive requests separate from every small visual movement when the operation does not need that frequency.

Use the complete SL UI Library package and inspect its current state and callback contract before wiring it. React and Next.js wrappers retain the original controller. Test endpoints, quick reversals, two equal range values, long unit labels, and reset. With reduced motion enabled, values should remain immediate and readable while decorative following effects become quieter.

Reference documentation

Technical documentation behind these examples. You can use the article without opening these links.

More practical guides

Button states: hover, focus, loading, success, and errorDesign clear button states with an interactive example, keyboard focus, loading feedback, and practical HTML, CSS, and JavaScript guidance.Animated buttons with HTML, CSS, and JavaScriptBuild purposeful button animation with CSS transitions, clear interaction states, reversible motion, and a reduced-motion alternative.