For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.4.1/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.4.1/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.4.1/en/components/snippet.md.

Snippet

Places one reusable short command or identifier beside its copy action in a boundary that scans well and survives narrow screens.

Live preview
npm install @a3s-lab/ui@0.4.1

Usage

<div class="snippet">
  <code>npm install @a3s-lab/ui@0.4.1</code><button type="button" class="btn copy-button" data-size="sm" data-copy-text="npm install @a3s-lab/ui@0.4.1"><span data-copy-label>Copy</span><span data-copy-feedback aria-live="polite"></span></button>
</div>

Contract

SurfaceValue
Root selector.snippet
Native root<div>
Statesready, copied, error
Events—
Methods—

Product boundary

Snippet does not own multiline highlighting, execution, or download. Use Highlighter for long code, Code Diff for changes, and the host for execution.

The component publishes a reusable interaction boundary only. Data fetching, persistence, permission, trusted content, and business entities remain host-owned.

Accessibility

Code stays left-to-right and horizontally scrollable. The copy action has a clear name and result feedback so keyboard users need not select text manually.