Skip to content
RivetUI

Code Block

Presents source code with file metadata, copying, and optional line numbers.

@rivetui/code-block

Preview

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/button

Content 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-block
Inspect registry item

Public interface

API reference

Component-specific props are listed here. Native element and Base UI props continue to pass through.

PropTypeDefault
codestring—
languagestring—
filenamestring—
copyablebooleantrue
showLineNumbersbooleanfalse
highlightLinesOnHoverbooleanfalse
softWrapbooleanfalse
Rivet UI / Code BlockComponents engineered, not decorated.