Snippet
One-line code or command display with copy button. Compound component: Provider, Input, Addon, Text, CopyButton. Use for install commands, tokens, or copyable snippets.
Install
Use Open-UI CLI or Shadcn CLI to install the component.
Open-UI CLI
Shadcn CLI
Usage
| Item | Prop | Default | Description | Type |
|---|---|---|---|---|
| Provider | code | — | Text to display and copy. | string |
| Provider | className | — | Additional CSS class for the root container. | string |
| Addon | align | inline-start | Alignment of the addon (inline/block, start/end). | "inline-start" | "inline-end" | "block-start" | "block-end" |
| CopyButton | onCopy | — | Called after the code is copied successfully. | () => void |
| CopyButton | onError | — | Called when copying fails (e.g. Clipboard API unavailable). | (error: Error) => void |
| CopyButton | timeout | 2000 | Time in ms to keep the copied state before resetting. | number |