Select controls
Choose from a finite set of known options using a native browser select.
Live preview
Native menus adapt to keyboard, touch and screen readers.
HTML
<div class="xsh-field" style="max-width:340px;width:100%">
<label class="xsh-label" for="xsh-example-select">Environment</label>
<select id="xsh-example-select" class="xsh-select">
<option value="production">Production</option>
<option value="staging">Staging</option>
<option value="development">Development</option>
</select>
<span class="xsh-help">Native menus adapt to keyboard, touch and screen readers.</span>
</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. |
xsh-field | Used by the example markup and component styles or behavior. |
xsh-label | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Browser-native select supports standard keyboard input and platform accessibility APIs.
Implementation note. Prefer native select for ordinary forms; choose comboboxes when free-text filtering is essential.
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.