Code groups
Show tabbed code samples and richer single blocks with filenames and highlights.
Plain fenced code blocks already render with syntax highlighting, a language label, and a copy button. Reach for these components when you want tabbed alternatives or extra chrome like a filename and highlighted lines.
Code groups
<CodeGroup> turns several fenced blocks into a tabbed set. The tab label is the
title written after the language on the fence line.
npm i -g @veluai/velu
<CodeGroup>```bash npmnpm i -g @veluai/velu``````bash pnpmpnpm add -g @veluai/velu``````bash yarnyarn global add @veluai/velu```</CodeGroup>
Set defaultIndex to choose which tab opens first (tabs are zero-indexed).
Single code blocks
Use <CodeBlock> when you want a filename, line numbers, or highlighted lines on
a standalone block.
{"name": "Acme Docs","colors": { "primary": "#dc143c" }}
<CodeBlock filename="velu.json" language="json" lineNumbers highlight="2">{`{"name": "Acme Docs","colors": { "primary": "#dc143c" }}`}</CodeBlock>
For most code, a plain fenced block is enough. Add a filename after the
language on the fence line to label it without reaching for <CodeBlock>.
CodeBlock properties
A filename shown in the block's header, with a matching file-type icon.
A label for the block's header when it isn't a filename.
The language used for syntax highlighting, such as json or bash.
Show a line-number gutter.
A range of lines to emphasize, such as "1-3,5".
A Lucide icon id for the block header.
Show the file-type or language icon in the header.
CodeGroup properties
The zero-based index of the tab shown first.