Slider

4 Slider variations from the W3C ARIA Authoring Practices Guide.

Slider (Color Viewer)

Three native range controls adjust red, green, and blue channels. The swatch and hexadecimal/RGB text update together.

Corresponding W3C APG example

Example

Keyboard interaction

Arrow keys change one step; Page Up/Down change a larger step. Home/End select the minimum/maximum. Drag the native range thumb with a mouse or touch.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-slider-change — Dispatched when the slider value changes. (target: <input type="range">, detail: { value: number })
  • input / change — Standard range input and change events. (target: <input type="range">, detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <p>
    <label>
      Red
      <input type="range" min="0" max="255" step="1" value="128">
    </label>
  </p>
  <p>
    <label>
      Green
      <input type="range" min="0" max="255" step="1" value="128">
    </label>
  </p>
  <p>
    <label>
      Blue
      <input type="range" min="0" max="255" step="1" value="128">
    </label>
  </p>
  <div data-color-preview aria-hidden="true" style="height:6rem;width:16rem;border:2px solid currentColor"></div>
  <p>
    <output data-color-output></output>
  </p>
</axxy-scope>

Slider (Media Seek)

A seek slider controls a real, locally generated 12-second audio sample containing one soft tone per second. No external media service is needed.

Corresponding W3C APG example

Example

0 seconds of 12 seconds

Keyboard interaction

Arrow keys change one step; Page Up/Down change a larger step. Home/End select the minimum/maximum. Drag the native range thumb with a mouse or touch. Play/Pause controls the sample; the slider tracks its current playback position.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-slider-change — Dispatched when the slider value changes. (target: <input type="range">, detail: { value: number })
  • input / change — Standard range input and change events. (target: <input type="range">, detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <audio id="seek-audio" src="/demo-tone.wav" preload="metadata"></audio>
  <button type="button" data-play aria-controls="seek-audio">Play sample</button>
  <p>
    <label>
      Playback position
      <input type="range" min="0" max="12" step="1" value="0">
    </label>
  </p>
  <p>
    <output data-playback-position>0 seconds of 12 seconds</output>
  </p>
  <p role="status" data-playback-status></p>
</axxy-scope>

Slider (Rating)

A ten-point satisfaction scale uses value text for the endpoint meanings. The initial zero value means that no rating has been selected.

Corresponding W3C APG example

Example

1: Extremely dissatisfied · 10: Extremely satisfied

Not rated

Keyboard interaction

Arrow keys change one step; Page Up/Down change a larger step. Home/End select the minimum/maximum. Drag the native range thumb with a mouse or touch. Page Up/Down moves two rating values. Home returns to the unrated value.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-slider-change — Dispatched when the slider value changes. (target: <input type="range">, detail: { value: number })
  • input / change — Standard range input and change events. (target: <input type="range">, detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <p>
    <label>
      Satisfaction
      <input type="range" min="0" max="10" step="1" value="0">
    </label>
  </p>
  <p>1: Extremely dissatisfied · 10: Extremely satisfied</p>
  <p>
    <output data-rating-output>Not rated</output>
  </p>
</axxy-scope>

Slider (Temperature)

A vertical native range control sets the temperature from 10 to 40 degrees Celsius. Its accessible value includes the unit.

Corresponding W3C APG example

Example

20 °C

Keyboard interaction

Arrow keys change one step; Page Up/Down change a larger step. Home/End select the minimum/maximum. Drag the native range thumb with a mouse or touch.

Events

Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.

  • axxy-slider-change — Dispatched when the slider value changes. (target: <input type="range">, detail: { value: number })
  • input / change — Standard range input and change events. (target: <input type="range">, detail: Native Event)

Events reference and examples

Example HTML

<axxy-scope>
  <p>
    <label for="temperature">Temperature</label>
  </p>
  <input id="temperature" type="range" min="10" max="40" step="1" value="20" aria-valuetext="20 degrees Celsius" aria-orientation="vertical" style="writing-mode:vertical-lr;direction:rtl;height:16rem;width:3rem">
  <p>
    <output for="temperature" data-temperature-output>20 °C</output>
  </p>
</axxy-scope>