Reorderable lists
Reorder list items with explicit keyboard-operable move buttons.
Live preview
- Review requirements
- Design interface
- Ship package
HTML
<ol class="xsh-reorder-list" data-xsh-reorder>
<li>
<span>Review requirements</span>
<button type="button" data-xsh-move="up" aria-label="Move Review requirements up">↑</button>
<button type="button" data-xsh-move="down" aria-label="Move Review requirements down">↓</button>
</li>
<li>
<span>Design interface</span>
<button type="button" data-xsh-move="up" aria-label="Move Design interface up">↑</button>
<button type="button" data-xsh-move="down" aria-label="Move Design interface down">↓</button>
</li>
<li>
<span>Ship package</span>
<button type="button" data-xsh-move="up" aria-label="Move Ship package up">↑</button>
<button type="button" data-xsh-move="down" aria-label="Move Ship package down">↓</button>
</li>
</ol>Installation & markup
Include the local stylesheet and script once on the page, then place the component inside a data-xsh-ui root. The example above works without a build system.
<link rel="stylesheet" href="/dist/xshna-ui.css">
<div data-xsh-ui>
<!-- Add the HTML example above -->
</div>
<script defer src="/dist/xshna-ui.js"></script>Component API
Public classes, attributes and hooks used by this example. Keep the xsh- prefix intact.
| Identifier | Contract |
|---|---|
xsh-reorder-list | Used by the example markup and component styles or behavior. |
data-xsh-reorder | Used by the example markup and component styles or behavior. |
data-xsh-move | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Move buttons rearrange DOM order, maintain focus and announce changes.
Implementation note. Use buttons instead of pointer-only drag handles for accessible rearrangement.
Interaction contract
Behavioral components use the shared delegated runtime; visual-only primitives rely on semantic HTML and CSS. Runtime controls emit bubbling xsh:* CustomEvents; bind application handlers to those events when server persistence, API data or navigation is required.