xxshna.ui
V 1.1.0Get started ↗
Components/Utilities

Keyboard shortcuts

Present shortcuts and key combinations using semantically recognizable keycaps.

Catalog · 1.1HTML, CSS & optional JSNo runtime dependencies

Live preview

Interactive exampleOpen playground ↗
Search documentationCtrl+K
Close overlayEsc
Move through tabs←→
HTML
<div class="xsh-stack">
<div class="xsh-row">
<span style="width:170px;font-size:12px">Search documentation</span>
<kbd class="xsh-kbd">Ctrl</kbd>
<span>+</span>
<kbd class="xsh-kbd">K</kbd>
</div>
<div class="xsh-row">
<span style="width:170px;font-size:12px">Close overlay</span>
<kbd class="xsh-kbd">Esc</kbd>
</div>
<div class="xsh-row">
<span style="width:170px;font-size:12px">Move through tabs</span>
<kbd class="xsh-kbd">←</kbd>
<kbd class="xsh-kbd">→</kbd>
</div>
</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.

IdentifierContract
xsh-kbdUsed by the example markup and component styles or behavior.
kbdUsed by the example markup and component styles or behavior.

Accessibility & keyboard

The kbd element communicates keyboard input semantically. Ensure documented shortcuts actually work in your application.

Implementation note. Avoid capturing shortcuts while a user is editing text. Provide discoverable, optional shortcuts.

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.