Transfer list
Move selected items between available and assigned lists without a server.
Live preview
HTML
<div class="xsh-transfer" data-xsh-transfer>
<label class="xsh-field">
<span class="xsh-label">Available roles</span>
<select class="xsh-select" size="5" multiple aria-label="Available roles">
<option value="admin">Administrator</option>
<option value="billing">Billing</option>
<option value="dev">Developer</option>
<option value="viewer">Viewer</option>
</select>
</label>
<div class="xsh-transfer__actions">
<button type="button" class="xsh-button xsh-button--secondary" data-xsh-transfer-to="right" aria-label="Assign selected">→</button>
<button type="button" class="xsh-button xsh-button--secondary" data-xsh-transfer-to="left" aria-label="Remove selected">←</button>
</div>
<label class="xsh-field">
<span class="xsh-label">Assigned roles</span>
<select class="xsh-select" size="5" multiple aria-label="Assigned roles">
</select>
</label>
</div>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-transfer | Used by the example markup and component styles or behavior. |
data-xsh-transfer | Used by the example markup and component styles or behavior. |
data-xsh-transfer-to | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Select items with native multi-select keys; move with buttons and keyboard.
Implementation note. Maintain item ordering and permissions in application state when connecting to persistence.
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.