Code Block
Presents source code with file metadata, copying, and optional line numbers.
@rivetui/code-blockPreview
Explore each composition interactively, then open its code in the same context.
Default
deploy-button.tsxtsx
import { Button } from "@/components/ui/button"
export function DeployButton() { return <Button>Deploy revision</Button>}Soft wrap
install.shshell
bunx --bun shadcn@latest add @rivetui/code-block @rivetui/terminal @rivetui/buttonContent only
const region = "eu-central-1"Registry
Installation
Add the component source and its declared dependencies with the shadcn CLI.
Install component
bunx --bun shadcn@latest add @rivetui/code-blockPublic interface
API reference
Component-specific props are listed here. Native element and Base UI props continue to pass through.
| Prop | Type | Default |
|---|---|---|
code | string | — |
language | string | — |
filename | string | — |
copyable | boolean | true |
showLineNumbers | boolean | false |
highlightLinesOnHover | boolean | false |
softWrap | boolean | false |