CodeBlock
Syntax-highlighted code display with clipboard copy, horizontal scrolling, line emphasis, diff rendering, collapsible folding, and tabbed alternatives.
The variant axis picks the surface (terminal > numbered > inline > plain, first match wins); compact tightens the density; copy, wrap, diff, collapsible, and attached stack orthogonally. language drives the in-kit highlighter (ts/tsx/js/jsx, json, bash, css, html, python; anything else renders monochrome), and long lines scroll horizontally instead of truncating.
When a line is wider than the block, Tab reaches the scrollable code and the platform's arrow keys scroll it; while it has keyboard focus, the block's card draws the theme's focus ring. Short content, wrap, and inline do not add a scrolling tab stop. Native scrolling continues to use the native ScrollView.
ts
iOS
ts
Android
ts
Web
tsx
Default
Syntax highlighting
Terminal
Numbered
Inline
Compact
Copy button
Wrap long lines
Terminal label
Highlight lines
Excerpt
Diff
Collapsible
Tabs
Props
Do & Don’t
Plain
Don’t
A paragraph collapses the line breaks and indentation, so multi-line code reads as one run-on string.
Do
Use CodeBlock so whitespace, line breaks, and indentation survive verbatim.
Terminal
Don’t
Selectable prompt text means a reader who copies the line drags the $ marker into their shell.
Do
Use the terminal variant: the prompt stays out of the selection, so a copy yields only the command, not the shell glyph.
Numbered
Don’t
Selectable line numbers get swept into the selection and pasted as 1 2 ahead of every line.
Do
Use the numbered variant: the gutter stays out of the selection, so copying the block returns clean, runnable code.
Diff
Don’t
Hand-colored +/- rows leave the markers selectable, so a copied block pastes broken code.
Do
ts
Use diff mode: markers stay out of the selection and the copy chip yields the post-change code.
Tabs
Don’t
Stacked one-per-manager blocks repeat the same install three times and triple the page height.
Do
One tabbed block keeps the package-manager alternatives in one place; the reader picks once.
Inline
Don’t
A long, multi-step command crammed inline wraps mid-token and offers no horizontal scroll.
Do
Run the setup command:
Reserve inline code for short tokens; move anything multi-line into a block.