Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-slider>

@methane-ui/ui~7.9 KB brotli (cold + Lit)~2.0 KB marginal

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

Interactive StageLive Custom Element · <mth-slider> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""Form field name submitted with FormData.
valuevaluenumber0Current numeric slider value.
defaultValuedefault-valuenumber0Initial numeric value restored on form reset.
minminnumber0Minimum selectable value.
maxmaxnumber100Maximum selectable value.
stepstepnumber1Step increment between valid values.
labellabelstring""Visible label associated with the slider.
hinthintstring""Helper text rendered below the slider.
errorerrorstring""Validation error message.
orientationorientation'horizontal' | 'vertical'"horizontal"Axis orientation (horizontal or vertical).
sizesize'sm' | 'md' | 'lg'"md"Visual size scale (sm, md, or lg).
showValueshow-valuebooleanfalseShows the current value beside the label.
disableddisabledbooleanfalseDisables slider interaction.
readonlyreadonlybooleanfalseMarks the slider read-only.
formatValue—((value: number) => string) | nullnullCustom formatter for readout and aria-valuetext.

Events

EventDetail TypeDescription
mth-input{ value: number }Dispatched continuously as the thumb moves.
mth-change{ value: number }Dispatched when a value change is committed.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrthumb focusedincreases value by one step
ArrowLeftrtlthumb focusedincreases value by one step in RTL
ArrowUpboththumb focusedincreases value by one step
ArrowDownboththumb focuseddecreases value by one step
PageUp / PageDownboththumb focusedsteps value by ten increments
Home / Endboththumb focusedmoves value to min or max

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 6 APG keyboard transitions across LTR/RTL.mth-slider.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled).Conformance suite
i18nRoutes 4 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test