Loading component…
Loading component…
Code to read and copy
To reuse this local React demo, copy all files from the Code tab into the same folder, then import CodeBlock from ./code-block.
import { CodeBlock } from "@/components/ui/code-block";
export function ReviewerConfig() {
return (
<CodeBlock
language="ts"
filename="agents/reviewer.ts"
showLineNumbers
highlightLines={[8, 9]}
code={`import { defineAgent } from "@acme/agents";
export const reviewer = defineAgent({
name: "Code reviewer",
model: "claude-opus",
tools: ["github", "linear"],
// Ask before anything leaves the repo
approval: { required: true, timeout: "2h" },
maxSteps: 24,
});`}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| code | string | Required. The code – copied exactly as given; one trailing newline isn't shown as an empty line | |
| language | string | ts, tsx, js, jsx, json, bash, sh, python … – TypeScript / JavaScript, JSON, Bash and Python are colored, anything else is plain text. Named in the header when there is no filename | |
| filename | string | Shown in the header instead of the language; long names end in … with the full name as a tooltip | |
| showLineNumbers | boolean | false | Numbers in front of every line – they stay in place while long lines scroll sideways and are left out when code is selected |
| highlightLines | number[] | Lines to mark, counted from 1 – a light blue tint with a thin edge on the left | |
| wrap | boolean | false | Long lines wrap instead of scrolling sideways |
| maxHeight | number \| string | After this height the code scrolls inside, e.g. 320 or "40vh" | |
| copyable | boolean | true | The copy button; without it and without a filename or language there is no header |
| onCopy | (code: string) => void | Called after the code was copied, e.g. to show a toast | |
| className / style | string / CSSProperties | On the root <figure> |
Never wider than its container: long lines scroll inside the card (or wrap with wrap) instead of stretching the page
Touch screens get a bigger hit area around the copy button
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.