Fenced code blocks are highlighted with Shiki at compile time. A title adds a file name header,
and :::code-group turns several blocks into accessible tabs.
title="…" (or [label]) adds a file name header and names the tab in a code group.
Markdown code blocks are highlighted at build time with syntaxHighlighting.themes of
recit.config.ts, in both modes. <CodeBlock> highlights on the client with a single theme, the
dark one of that pair by default.
In MDX, <CodeBlock> and <CodeGroup> highlight code on the client.
Attributes and props
CodeBlock
Prop
Type
Default
Description
code
string
—
Source code (required)
language
string
—
Shiki language (required)
fileName
string
—
Header above the code
theme
string
github-dark
Shiki theme
showLineNumbers
boolean
true
Line numbers in the gutter
autoFit
boolean
true
Smaller font for long snippets
CodeGroup
Prop
Type
Default
Description
tabs
{ label, language, code }[]
—
One tab per snippet
In other formats
Format
Status
Notes
deck
Available
Rendered in slides, the presenter console and the HTML and PDF exports.
docs
Available
Through <StoryEmbed slug="…" /> in any page of a site.