Drawers
Expose secondary workflows in a focused side panel.
Live preview
HTML
<button class="xsh-button" data-xsh-dialog-open="xsh-example-drawer">Open details panel →</button>
<dialog class="xsh-drawer" id="xsh-example-drawer" aria-labelledby="xsh-example-drawer-title">
<div class="xsh-dialog__header">
<h2 class="xsh-dialog__title" id="xsh-example-drawer-title">Workspace details</h2>
</div>
<div class="xsh-dialog__body">
<div class="xsh-field">
<label class="xsh-label" for="xsh-drawer-name">Workspace name</label>
<input id="xsh-drawer-name" class="xsh-input" value="Northstar Studio">
</div>
<p>Review settings without navigating away from your current page.</p>
</div>
<div class="xsh-dialog__footer">
<button class="xsh-button xsh-button--secondary" data-xsh-dialog-close>Cancel</button>
<button class="xsh-button" data-xsh-dialog-close data-xsh-toast="success" data-xsh-message="Workspace settings updated.">Save changes</button>
</div>
</dialog>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-drawer | Used by the example markup and component styles or behavior. |
xsh-dialog__header | Used by the example markup and component styles or behavior. |
xsh-dialog__body | Used by the example markup and component styles or behavior. |
xsh-dialog__footer | Used by the example markup and component styles or behavior. |
data-xsh-dialog-open | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Uses native modal dialog interaction. Tab stays inside and Escape closes the drawer.
Implementation note. Use a drawer for contextual editing rather than for blocking, multi-step transactions.
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.