← All Components
<mth-slider>
Form-associated single-thumb range slider with ARIA slider semantics, pointer dragging, RTL keyboard stepping, and dynamic CSS custom properties.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-slider>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/slider"></script>
<mth-slider value="0" default-value="0"></mth-slider>import '@methane-ui/ui/slider';
import '@methane-ui/react';
export function Example() {
return <mth-slider value="0" default-value="0"></mth-slider>;
}<script setup lang="ts">
import '@methane-ui/ui/slider';
</script>
<template>
<mth-slider value="0" default-value="0"></mth-slider>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/slider';
import { MthSliderDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSliderDirective],
template: `<mth-slider value="0" default-value="0"></mth-slider>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/slider';
import MthSlider from '@methane-ui/svelte/MthSlider.svelte';
</script>
<MthSlider value="0" default-value="0"></MthSlider>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
name | name | string | "" | Form field name submitted with FormData. |
value | value | number | 0 | Current numeric slider value. |
defaultValue | default-value | number | 0 | Initial numeric value restored on form reset. |
min | min | number | 0 | Minimum selectable value. |
max | max | number | 100 | Maximum selectable value. |
step | step | number | 1 | Step increment between valid values. |
label | label | string | "" | Visible label associated with the slider. |
hint | hint | string | "" | Helper text rendered below the slider. |
error | error | string | "" | Validation error message. |
orientation | orientation | 'horizontal' | 'vertical' | "horizontal" | Axis orientation (horizontal or vertical). |
size | size | 'sm' | 'md' | 'lg' | "md" | Visual size scale (sm, md, or lg). |
showValue | show-value | boolean | false | Shows the current value beside the label. |
disabled | disabled | boolean | false | Disables slider interaction. |
readonly | readonly | boolean | false | Marks the slider read-only. |
formatValue | — | ((value: number) => string) | null | null | Custom formatter for readout and aria-valuetext. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-input | { value: number } | Dispatched continuously as the thumb moves. |
mth-change | { value: number } | Dispatched when a value change is committed. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | thumb focused | increases value by one step |
| ArrowLeft | rtl | thumb focused | increases value by one step in RTL |
| ArrowUp | both | thumb focused | increases value by one step |
| ArrowDown | both | thumb focused | decreases value by one step |
| PageUp / PageDown | both | thumb focused | steps value by ten increments |
| Home / End | both | thumb focused | moves value to min or max |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 6 APG keyboard transitions across LTR/RTL. | mth-slider.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |