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

<mth-sortable>

@methane-ui/ui~10.1 KB brotli (cold + Lit)~3.2 KB marginal

Accessible pointer-and-keyboard reorderable list powered by DragSortController, RovingFocusController, and LiveAnnouncer.

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-sortable> (@methane-ui/ui)
1. Compile DTCG Tokens
2. Build ESM Bundles
3. Run WebKit E2E
Ready · interact with <mth-sortable>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/sortable"></script>
<mth-sortable orientation="vertical">Example</mth-sortable>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
orientationorientation'vertical' | 'horizontal'"vertical"List axis (vertical or horizontal, RTL-aware).
disableddisabledbooleanfalseDisables drag and keyboard reordering.
labellabelstring""Accessible aria-label for the sortable list container.

Events

EventDetail TypeDescription
mth-reorder{ fromIndex: number; toIndex: number; item: HTMLElement }Fired when an item is moved from fromIndex to toIndex.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowUpbothVertical list item is focusedMoves focus to previous sortable item
ArrowDownbothVertical list item is focusedMoves focus to next sortable item
bothSortable item is focusedGrabs or drops item for keyboard reordering with Arrow keys
EscapebothKeyboard reorder is in progressCancels reorder and restores original position

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 4 APG keyboard transitions across LTR/RTL.mth-sortable.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(disabled), :state(dragging).Conformance suite
i18nRoutes 4 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test