Quaff

QSlider

Sliders adjust a single value or the bounds of a range. Continuous movement, fixed steps, and value indicators help users make precise selections.

info QSlider API Source

interface QSliderProps extends QSliderHTMLInputAttributes

centered
?: boolean = false
Uses the center of the range as the slider origin.

class
?: HTMLAttributes<HTMLDivElement>["class"] = undefined
Classes applied to the slider wrapper.

color
?: string = primary
Active track and handle color.

disabled
?: boolean = false
Puts the component into a disabled state, which prevents user interaction.

expressive
?: boolean = undefined
Enables Material 3 Expressive sizes, vertical orientation, and inset icons. When omitted, inherits the `Quaff.init()` setting (false by default). Set true or false to override it.

icon
?: MaterialSymbol | Snippet = undefined
Optional inset icon for a standard expressive slider of size md, lg, or xl.

label
?: boolean = false
Shows the current value while the handle is pressed or keyboard-focused.

labelValue
?: string | number = undefined
Text shown in the value indicator instead of the numeric value.

markers
?: boolean | number = false
Shows stop indicators, limiting their density to fit the track. A number sets both their interval and the snapping increment; true uses the step interval.

max
?: number = 100
Maximum selectable value.

min
?: number = 0
Minimum selectable value.

readonly
?: boolean = false
Prevents value changes while retaining keyboard focus.

reverse
?: boolean = false
Reverses the value direction.

size
?: QSliderSize = xs
Slider size. Sizes other than xs are available in expressive mode.

step
?: number = 1
Value increment. Set to 0 for continuous pointer input.

style
?: HTMLAttributes<HTMLDivElement>["style"] = undefined
Styles applied to the slider wrapper.

trackColor
?: string = secondary-container
Inactive track color.

value
?: number = $bindable(0)
The bound value of the component.

vertical
?: boolean = false
Uses a vertical orientation. Available in expressive mode. Material 3 recommends keeping range sliders horizontal to reduce cognitive load.
info QRange API Source

interface QRangeProps extends QSliderHTMLInputAttributes

class
?: HTMLAttributes<HTMLDivElement>["class"] = undefined
Classes applied to the slider wrapper.

color
?: string = primary
Active track and handle color.

disabled
?: boolean = false
Puts the component into a disabled state, which prevents user interaction.

expressive
?: boolean = undefined
Enables Material 3 Expressive sizes, vertical orientation, and inset icons. When omitted, inherits the `Quaff.init()` setting (false by default). Set true or false to override it.

icon
?: MaterialSymbol | Snippet = undefined
Optional inset icon for a standard expressive slider of size md, lg, or xl.

label
?: boolean = false
Shows the current value while the handle is pressed or keyboard-focused.

markers
?: boolean | number = false
Shows stop indicators, limiting their density to fit the track. A number sets both their interval and the snapping increment; true uses the step interval.

max
?: number = 100
Maximum selectable value.

maxAriaLabel
?: string = undefined
Accessible label for the upper-value handle.

maxLabelValue
?: string | number = undefined
Text shown for the upper value indicator.

min
?: number = 0
Minimum selectable value.

minAriaLabel
?: string = undefined
Accessible label for the lower-value handle.

minLabelValue
?: string | number = undefined
Text shown for the lower value indicator.

readonly
?: boolean = false
Prevents value changes while retaining keyboard focus.

reverse
?: boolean = false
Reverses the value direction.

size
?: QSliderSize = xs
Slider size. Sizes other than xs are available in expressive mode.

step
?: number = 1
Value increment. Set to 0 for continuous pointer input.

style
?: HTMLAttributes<HTMLDivElement>["style"] = undefined
Styles applied to the slider wrapper.

trackColor
?: string = secondary-container
Inactive track color.

value
?: QRangeValue = $bindable([0, 100])
The bound value of the component.

vertical
?: boolean = false
Uses a vertical orientation. Available in expressive mode. Material 3 recommends keeping range sliders horizontal to reduce cognitive load.

Usage

Basic Usage
Bind value to read and update a number. The default range is 0–100; set min and max to change it.
Image Adjustments
Use centered for adjustments around zero. Set step and markers for fixed stops, and labelValue to name them. These sliders update the image as you drag.
Exposure and contrast preview

0 stops

Normal

Range Selection
QRange binds a lower and upper value as a tuple. Name each handle with minAriaLabel and maxAriaLabel; customize their indicators with minLabelValue and maxLabelValue. Here they format prices.

Price range

$40–$120
Appearance and Interaction
Compare track sizes, colors, stops and interaction states. Sizes above xs require expressive; inset icons appear at md, lg and xl. Omit expressive to inherit the setting from Quaff.init().
Expressive styling
Reverse direction
Show value while dragging
Use a custom inset icon
Read-only
Disabled

Value indicators appear while dragging or when the handle has keyboard focus.

Last committed value: 65%.

step={0} allows continuous pointer input. Numeric markers set both the stop spacing and the snapping increment, overriding step. Binding updates while dragging; onchange records the committed value. readonly retains focus and prevents edits; disabled also removes keyboard access.

Vertical Sliders
Use vertical with expressive and give the slider a height.
Accessibility
Each handle is a native range input. Tab reaches it; arrow keys adjust its value, Home and End select the endpoints, and Space with an arrow moves one interval. Associate a visible label with a single slider using for/id or aria-labelledby. labelValue supplies the visual indicator and accessible value text for named stops.