ReferenceSliders
media-slider
A composable slider component with track, fill, thumb, preview, and value parts
Import
Anatomy
Behavior
The base slider provides a generic range input. It manages value, pointer tracking, and drag interactions. The time slider and volume slider add media-specific bindings. The time slider also provides parts for rendering chapter ranges and the chapter at the current interaction position.
media-slider-thumbnail supplies the pointer value and draws the image in its shadow DOM. Supply an <img> child to replace it: the element controls src and srcset on your image, and other children can provide loading indicators or overlays.
The slider supports vertical orientation via the orientation prop (defaults to "horizontal").
Styling
Use CSS custom properties to position fill, thumb, and preview elements:
Style based on interaction state:
Accessibility
Renders with role="slider" and automatic ARIA attributes (aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext). Override the label with the label prop. Keyboard controls:
- Arrow Left / Arrow Right: step by
stepincrement - Page Up / Page Down: step by
largeStepincrement - Home: jump to minimum
- End: jump to maximum
Examples
Basic
A slider with track, fill, and thumb.
With Preview
A slider with a pointer-tracking preview that displays the value at the current pointer position.
API Reference
media-slider
Props
State
Data attributes
CSS custom properties
media-slider-preview
Positioning container for preview content that tracks the pointer along the slider.
Props
Data attributes
media-slider-thumb
Draggable handle for setting the slider value. Receives focus and handles keyboard interaction.