Slider

Material Design 3 slider web component (single value, native <input type="range">-based).

  • 2.7 KB gzipped
  • @lit-material/slider 0.0.4
  • Renders on the server

Example

Install

npm install @lit-material/slider @lit-material/tokens
import "@lit-material/slider";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-slider>

Material Design 3 slider — a single value between min and max, built on a real native <input type="range"> for keyboard (arrows/Home/End/ PageUp/PageDown), pointer dragging, value clamping/stepping, and ARIA slider semantics, styled invisibly on top of custom-drawn track/thumb visuals — the same pattern lit-material-checkbox/radio/switch use.

Properties

PropertyAttributeTypeDefaultDescription
minminnumber0
maxmaxnumber100
stepstepnumber1
valuevaluenumber0
disableddisabledbooleanfalse
namenamestring""
formformstring | undefinednone
ariaLabelaria-labelstring | nullnullForwarded to the inner control; sliders have no visible label so this is often required.
ariaLabelledByaria-labelledbystring | nullnull

Events

EventDescription
changeBubbles once the value change is committed (matches native <input>).
inputBubbles live as the value changes while dragging/pressing a key (matches native <input>).

CSS parts

PartDescription
trackThe full-width background track.
track-activeThe filled portion of the track, from the start to the thumb.
thumbThe draggable circular thumb.
value-labelThe value bubble shown above the thumb while focused/dragging.
rippleThe state-layer element the hover/press feedback is drawn on.
focus-ringThe focus indicator element.

Source on GitHub npm