# Shadcn Code Block Components

A syntax highlighted code block with copy and download actions, line numbers, diffs, diagnostics, folding and streaming support for docs and AI chat interfaces.

- Page: https://shadcnuikit.com/components/code-block
- Variants: 18 (18 free, 0 pro)
- Built with shadcn/ui, Tailwind CSS v4, React and Next.js

- [Basic](https://shadcnuikit.com/components/code-block/1) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block1`)
- [Pinned copy button](https://shadcnuikit.com/components/code-block/2) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block2`)
- [Highlighted lines and words](https://shadcnuikit.com/components/code-block/3) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block3`)
- [Focused lines](https://shadcnuikit.com/components/code-block/4) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block4`)
- [Diff](https://shadcnuikit.com/components/code-block/5) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block5`)
- [Diagnostics](https://shadcnuikit.com/components/code-block/6) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block6`)
- [Collapsible](https://shadcnuikit.com/components/code-block/7) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block7`)
- [Word wrap](https://shadcnuikit.com/components/code-block/8) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block8`)
- [Install command](https://shadcnuikit.com/components/code-block/9) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block9`)
- [File tabs](https://shadcnuikit.com/components/code-block/10) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block10`)
- [Streaming response](https://shadcnuikit.com/components/code-block/11) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block11`)
- [AI chat message](https://shadcnuikit.com/components/code-block/12) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block12`)
- [Patch review](https://shadcnuikit.com/components/code-block/13) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block13`)
- [Code folding](https://shadcnuikit.com/components/code-block/14) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block14`)
- [Fix with AI](https://shadcnuikit.com/components/code-block/15) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block15`)
- [Terminal output](https://shadcnuikit.com/components/code-block/16) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block16`)
- [Reference lines in chat](https://shadcnuikit.com/components/code-block/17) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block17`)
- [Theme token colors](https://shadcnuikit.com/components/code-block/18) (Free, install: `npx shadcn@latest add @shadcnuikit/code-block18`)

## Install with the shadcn CLI

Add the registry to components.json once:

```json
"registries": {
  "@shadcnuikit": {
    "url": "https://shadcnuikit.com/r/{name}.json",
    "headers": {
      "Authorization": "Bearer ${REGISTRY_TOKEN}"
    }
  }
}
```

Then install any item by its registry name, for example `npx shadcn@latest add @shadcnuikit/hero1`. Free items install without an API key. Pro items need a license and an API key from https://shadcnuikit.com/account/api-keys, set as REGISTRY_TOKEN in your .env file.

More from Shadcn UI Kit: [llms.txt](https://shadcnuikit.com/llms.txt)