Documentation index: /llms.txt. Each page is also available as Markdown by adding .md to its URL.

Skip to content
Brief

Code

Syntax-highlighted code block and folder explorer.

Code Block Showcase Controls

Group multiple code blocks into an IDE-like folder explorer.

greeting.ts

Use a single code block for short examples.

Usage#

Inline Code#

Add a language attribute to highlight code within a sentence: const count = 1. Use Ref<string> to highlight a TypeScript type fragment.

Code Block#

Write a fenced code block with a language for syntax highlighting.

Header#

Add a filename in square brackets to show a header, or omit it for a headerless block.

Line Numbers#

Set lineNumbers=true to show line numbers.

Line Highlights & Diffs#

Use added, deleted, and highlighted ranges to highlight particular lines.

Compact#

Set compact=true to align the block's borders with the text column without changing its inner padding. This only affects standalone blocks on desktop.

Code Group#

Wrap related code blocks in CodeBlockGroup. File paths dictate the folder structure.

Set the group's lineNumbers to true to enable numbers for every file, or false to hide them. Each fence keeps its own annotation ranges.

Code Tabs#

Wrap standalone fences, complete code groups, or terminals in CodeTabs. The tab row belongs to the outer frame. Files inside a code group keep their normal headers.

Fences use their filename and language icon as the tab label. Groups use title; terminals use title or their shell name. The selected label changes color without changing weight or adding an indicator.

Synchronization#

Use the same syncID and explicit syncValue values on CodeTabs and ordinary Tabs. Selecting either updates all matching groups and persists the choice in local storage. A group without the selected value shows its first option without overwriting the shared preference.

The examples use TypeScript.

Groups with Tabs#

Place entire CodeBlockGroup components inside CodeTabs, with a title and syncValue on each group. Individual files cannot contain tab groups.

Terminals with Tabs#

Terminal options retain their own prompts, recordings, and copy controls. Put syncValue on the Terminal, not its steps.

Code Tabs Reference#

syncIDDefault undefined
string

Share selection with Tabs and CodeTabs using the same ID and syncValue options.

compactDefault false
boolean

Align the desktop frame with the content column.

Code Block Reference#

syncValueDefault undefined
string

Selection value when this surface is a direct child of synchronized CodeTabs.

filenameDefault undefined
string

File path shown in the header. Omit for a headerless block.

languageDefault undefined
string

Syntax-highlighting language. Omit for plain text.

lineNumbersDefault false
boolean

Show line numbers. A group controls this for all its files.

compactDefault false
boolean

Align borders with the content column without changing inner padding. Only affects standalone blocks on desktop.

addedDefault undefined
string

One-based line ranges tinted with the positive color role.

deletedDefault undefined
string

One-based line ranges tinted with the negative color role. Text remains available for copying.

highlightedDefault undefined
string

One-based line ranges tinted with the accent color role. Each line can have only one annotation.

Code Group Reference#

titleDefault undefined
string

Tab label when this group is a direct child of CodeTabs.

syncValueDefault undefined
string

Selection value when this surface is a direct child of synchronized CodeTabs.

lineNumbersDefault false
boolean

Display line numbers for every fence in the group.