Multi-select fields
Select multiple options through native HTML without a custom menu implementation.
Live preview
Use Ctrl/Cmd-click to choose several options.
HTML
<div class="xsh-field xsh-measure">
<label class="xsh-label" for="xsh-interests">Functional areas</label>
<select id="xsh-interests" class="xsh-select" size="5" multiple>
<option>Engineering</option>
<option>Design</option>
<option>Operations</option>
<option>Compliance</option>
<option>Analytics</option>
</select>
<small class="xsh-help">Use Ctrl/Cmd-click to choose several options.</small>
</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-select | Used by the example markup and component styles or behavior. |
multiple | Used by the example markup and component styles or behavior. |
size | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Native multi-selection and focus behavior vary slightly by browser.
Implementation note. For lengthy lists, use a well-tested combobox implementation.
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.