Search

Search components and blocks

Sign in

Code Block

A syntax-highlighted code surface with stable streaming updates, line numbers, focused lines, smooth following, and copy feedback.

pnpm dlx shadcn@latest add @ditherui/agent-code-block
TSXagent/greet.tsGenerating

Install

$ pnpm dlx shadcn@latest add @ditherui/agent-code-block

Props

codestring—
langstring"tsx"
filenamestring—
focusedLinesnumber[]—
streamingbooleanfalse
classNamestring—

When to use the code block

Use the code block to show code with highlighting. It handles streaming updates, line numbers, focused lines and copy feedback.

  • Open the CLI tab on any preview above for the exact shadcn command. The source is copied into your project, so you can edit it like any other file.

Suggested components