Snippet
Lightweight inline code display for terminal commands and short code references.
The Snippet component provides a lightweight way to display terminal commands and short code snippets with copy functionality. Built on top of InputGroup, it's designed for brief code references in text.
Installation
npx ai-elements@latest add snippet
Features
- Composable architecture with InputGroup
- Optional prefix text (e.g.,
$for terminal commands) - Built-in copy button
- Compact design for chat/markdown
Examples
Without Prefix
Props
<Snippet />
Prop
Type
<SnippetAddon />
Prop
Type
<SnippetText />
Prop
Type
<SnippetInput />
Prop
Type
<SnippetCopyButton />
Prop
Type