Skip to content
FrameworkStyle

media-slider

A composable slider component with track, fill, thumb, preview, and value parts

Anatomy

<media-slider>
  <media-slider-track>
    <media-slider-fill></media-slider-fill>
  </media-slider-track>
  <media-slider-thumb></media-slider-thumb>
  <media-slider-preview>
    <media-slider-value type="pointer"></media-slider-value>
  </media-slider-preview>
</media-slider>

Behavior

The base Slider provides a generic range input. It manages value, pointer tracking, and drag interactions. Domain-specific sliders like TimeSlider and VolumeSlider extend this with media-specific bindings.

The slider supports vertical orientation via the orientation prop (defaults to "horizontal").

Styling

Use CSS custom properties to position fill, thumb, and preview elements:

media-slider-fill {
  width: var(--media-slider-fill);
}

media-slider-thumb {
  left: var(--media-slider-fill);
}

Style based on interaction state:

media-slider[data-interactive] media-slider-track {
  height: 6px;
}
media-slider[data-pointing] media-slider-preview {
  opacity: 1;
}

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 step increment
  • Page Up / Page Down: step by largeStep increment
  • Home: jump to minimum
  • End: jump to maximum

Examples

Basic

A slider with track, fill, and thumb.

<div class="demo">
    <media-slider class="media-slider" value="50">
        <media-slider-track class="media-slider-track">
            <media-slider-fill class="media-slider-fill"></media-slider-fill>
        </media-slider-track>
        <media-slider-thumb class="media-slider-thumb"></media-slider-thumb>
    </media-slider>
</div>

With Preview

A slider with a pointer-tracking preview that displays the value at the current pointer position.

<div class="demo">
    <media-slider class="media-slider" value="50">
        <media-slider-track class="media-slider-track">
            <media-slider-fill class="media-slider-fill"></media-slider-fill>
        </media-slider-track>
        <media-slider-thumb class="media-slider-thumb"></media-slider-thumb>
        <media-slider-preview class="preview">
            <media-slider-value type="pointer" class="media-slider-value"></media-slider-value>
        </media-slider-preview>
    </media-slider>
</div>

API Reference

media-slider

Props

Prop Type Default Details
disabled boolean false
label 'play' | 'pause' | 'replay' | 'mute' | 'unmute' | 'seekForward' | 'seekBackward' | 'enterFullscreen' | 'exitFullscreen' | 'enableCaptions' | 'disableCaptions' | 'enterPictureInPicture' | 'exitPictureInPicture' | 'playingLive' | 'seekToLiveEdge' | 'liveBadge' | 'startCasting' | 'stopCasting' | 'connectingCast' | 'seek' | 'volume' | 'timeCurrent' | 'timeDuration' | 'timeRemaining' | 'timeRemainingPhrase' | 'playbackRateAria' | 'timeSliderValueTextRange' | 'volumeSliderValueTextMuted' | 'indicatorMuted' | 'indicatorVolume' | 'indicatorVolumeWithValue' | 'indicatorCaptionsOn' | 'indicatorCaptionsOff' | 'indicatorPaused' | 'indicatorPlaying' | 'indicatorFullscreen' | 'indicatorExitFullscreen' | 'indicatorPictureInPicture' | 'indicatorExitPictureInPicture' | 'mediaErrorAborted' | 'mediaErrorNetwork' | 'mediaErrorDecode' | 'mediaErrorSrcNotSupported' | 'mediaErrorEncrypted' | 'mediaErrorCustom' | 'errorDialogTitle' | 'errorDialogDismiss' | 'mediaErrorFallback' | string & object | function ''
largeStep number 10
max number 100
min number 0
orientation 'horizontal' | 'vertical' 'horizontal'
step number 1
thumbAlignment 'center' | 'edge' 'center'
value number 0

State

State is reflected as data attributes for CSS styling.

Property Type Details
value number
fillPercent number
pointerPercent number
dragging boolean
pointing boolean
interactive boolean
orientation 'horizontal' | 'vertical'
disabled boolean
thumbAlignment 'center' | 'edge'

Data attributes

Attribute Type Details
data-dragging
data-pointing
data-interactive
data-orientation 'horizontal' | 'vertical'
data-disabled

CSS custom properties

Variable Details
--media-slider-fill
--media-slider-pointer
--media-slider-buffer

media-slider-buffer

Displays the buffered range on the slider track.

media-slider-fill

Displays the filled portion from start to the current value.

media-slider-preview

Positioning container for preview content that tracks the pointer along the slider.

Props

Prop Type Default Details
overflow SliderPreviewOverflow

Data attributes

Attribute Type Details
data-dragging
data-pointing
data-interactive
data-orientation 'horizontal' | 'vertical'
data-disabled

media-slider-thumb

Draggable handle for setting the slider value. Receives focus and handles keyboard interaction.

Data attributes

Attribute Type Details
data-dragging
data-pointing
data-interactive
data-orientation 'horizontal' | 'vertical'
data-disabled

media-slider-thumbnail

media-slider-track

Contains the slider's visual track and interactive hit zone.

media-slider-value

Displays a formatted text representation of the slider value. Renders an <output> element.

Props

Prop Type Default Details
format ((value: number) => string)
type "current" | "pointer"

Data attributes

Attribute Type Details
data-dragging
data-pointing
data-interactive
data-orientation 'horizontal' | 'vertical'
data-disabled