File uploads
Provide a clear entry point for native file selection with filename feedback.
Live preview
Files stay on your device until your application uploads them.
No file selected
<div class="xsh-upload" style="width:100%;max-width:470px">
<div style="font-size:26px;margin-bottom:9px;color:#3765cd">⇧</div>
<strong style="font-size:13px">Attach an asset</strong>
<p class="xsh-muted xsh-small">Files stay on your device until your application uploads them.</p>
<input type="file" id="xsh-demo-file" class="xsh-sr-only" aria-label="Select file" data-xsh-file-output="xsh-demo-file-output">
<button class="xsh-button xsh-button--secondary" data-xsh-file-pick="xsh-demo-file" type="button">Browse files</button>
<p id="xsh-demo-file-output" class="xsh-help" aria-live="polite" style="margin-bottom:0">No file selected</p>
</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-upload | Used by the example markup and component styles or behavior. |
data-xsh-file-pick | Used by the example markup and component styles or behavior. |
data-xsh-file-output | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
The hidden native file input retains accessibility through its label. The selected filename is announced in an aria-live region.
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.