Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Shared
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Hooks
Resources
Snippet
A command line snippet with a copy button.
$npx shadcn@latest add @frontal-labs/button
$git checkout -b feat/particles
$git push -u origin feat/particles
>bun add @frontal-labs/ui
import { Snippet } from "@/registry/default/shared/snippet";
export default function Particle() {
return (
<div className="flex w-full max-w-md flex-col gap-4">
<Snippet>npx shadcn@latest add @frontal-labs/button</Snippet>
<Snippet
lines={[
{ text: "git checkout -b feat/particles" },
{ text: "git push -u origin feat/particles" },
]}
/>
<Snippet prompt=">" variant="inverted">
bun add @frontal-labs/ui
</Snippet>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @frontal-labs/snippet
Usage
import { Snippet } from "@/components/snippet";<Snippet>npm install @frontal-labs/ui</Snippet>Pass lines to render several commands in one block, each with its own prompt:
<Snippet
lines={[
{ text: "git clone https://github.com/acme/repo.git" },
{ text: "cd repo" },
{ prompt: "#", text: "bun install" },
]}
/>API Reference
| Export | Props |
|---|---|
Snippet | <div> attributes, plus its own options |
snippetVariants | cva variants for the root element |
Snippet
| Prop | Type | Default |
|---|---|---|
variant | "default" | "inverted" | "default" |
showPrompt | boolean | true |
prompt | string | "$" |
onCopy | () => void | |
lines | { text: string; prompt?: string }[] | |
className | string |
When lines is set it replaces children, and each entry's prompt overrides
the block-level prompt. Copying joins the line texts with newlines; otherwise
it copies the rendered children. The copy button shows a check for two seconds
and calls onCopy after the clipboard write resolves.
The SnippetProps type is exported alongside the component.
Open the source under Manual above for the exact prop types.
On This Page