App components / Code blocks
Code block
Code in a flat card with a header (a file name or tabs, or none), optional line numbers and copy with a tick. JetBrains Mono throughout. It takes plain text or HTML you've already highlighted; there's no highlighter inside, so it stays light.
MembersReact · Vue · HTMLFigma: Code blocks
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
lib/projects.tsts
import { Northwind } from "@northwind/client"; const client = new Northwind({ apiKey: process.env.NORTHWIND_KEY }); export async function listProjects() { const { data } = await client.projects.list({ status: "active" }); return data.map((p) => ({ id: p.id, name: p.name }));}Installation
Examples
Tabs
Header Tabs, Line numbers No. Arrow keys move between the files.
tsx
<Button variant="primary" size="m"> Create project</Button>No header
Header None: copy floats in the corner. Here with HTML highlighted ahead of time.
curl https://api.northwind.dev/v1/projects \ -H "Authorization: Bearer $NORTHWIND_KEY"Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
01Copy turns into a tick that draws itself, then settles back.
02The tab highlight glides to the tab you pick and the code fades across.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| code / html | string | – | Plain text, or pre-highlighted HTML with one line per \n (Shiki's output works). |
| header | "file-name" | "tabs" | "none" | – | The Figma Header axis. Left out, it follows what you pass: tabs, a filename, or none. |
| filename / language | string | – | Mono on the header; the language in mono capitals on the right. |
| tabs / defaultTab / onTabChange | { id, label, code?, html?, language? }[] | – | One tab per file. Arrow keys move between them. |
| lineNumbers | boolean | false | The Figma Line numbers axis. The gutter stays put when the code scrolls sideways. |
| highlight | number[] | – | Line numbers to mark with a quiet band. |
| maxHeight | number | – | Caps the height; longer code scrolls. |
| CodeLines | component | – | Just the lines, for your own cards. |
Usage
Use it for
- Docs, READMEs, API references and onboarding steps.
- Several files of one example, as tabs.
Avoid
- A single command to run: use the Terminal command.
- Code inside a sentence: use Inline code.
- Changes to a file: use the Diff block.