Components
Code Block
Multi-line code with a header and optional filename.
With header
index.md markdown
# Field notes
Ship *small*, ship **often**.
- [x] Draft the note in mrkdwn
- [ ] Set the type in buena mono <div class="rounded-lg border border-separator bg-bg-surface">
<div class="flex items-center justify-between border-b border-separator px-4 py-2">
<span class="font-mono text-xs text-text-secondary">index.md</span>
<span class="text-xs text-text-tertiary">markdown</span>
</div>
<pre class="p-4 font-mono text-xs">…</pre>
</div> With line numbers
index.md markdown
1 # Field notes
2
3 Ship *small*, ship **often**.
4
5 - [x] Draft the note in mrkdwn
6 - [ ] Set the type in buena mono
Line features
publish.md highlighted lines
1 # Publishing a note
2 Save the file — that is the release.
3 No build step, no ceremony.
4 The note is live at its slug.
index.md diff
- [x] Draft the note in mrkdwn
- - [ ] Set the type in Helvetica
+ - [x] Set the type in buena mono
- [ ] Publish
Ship *small*, ship **often** —
no filename, just the block. {/* highlighted line */}
<div class="bg-bg-elevated">…</div>
{/* diff rows */}
<div class="bg-success/10 text-success"><span class="select-none">+</span> …</div>
<div class="bg-error/10 text-error"><span class="select-none">-</span> …</div> Language switcher
publish.ts
export const publish = (note: Note) => save(note);
The switcher prop adds a dropdown of language variants
(options, value, onChange).
{/* the `switcher` prop renders a dropdown of language variants */}
<CodeBlock switcher={{ options, value, onChange }}>…</CodeBlock> Tabs & Open in v0
index.ts index.js
import { publish } from "./publish"; tabs renders the variants as tabs instead of a dropdown;
v0="ask" or "build" adds the
Open in v0 toolbar button.
{/* `tabs` shows variants as tabs; `v0="build"` adds an Open in v0 button */}
<CodeBlock tabs={{ options, value, onChange }} v0="build">…</CodeBlock> Referenced lines
Markdown for agents: /design/code-block.md · spec: /design.md