A code block with monochrome syntax (weight and shade, no colours), clickable line numbers that mark a line or a shift-click range, files that switch with a lift and settle, and a copy that flashes every line.
pnpm dlx shadcn@latest add https://beautiful-ui.dev/r/code-block.jsonpnpm dlx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/code-block.jsonFree, no account or key. Use the command for your project's primitives: a radix-*, new-york or default style in components.json is Radix, a base-* style is Base UI. With the @beautiful-ui registry added, @beautiful-ui/<name> picks for you.
The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
Import it and pass your content. The props that matter most are listed next.
import { CodeBlock } from "@/components/ui/notchset/code-block";
const code = [
'import { Relay } from "@relay/sdk";',
"",
"const relay = new Relay({ apiKey: process.env.RELAY_KEY });",
"",
"export async function run(prompt: string) {",
' const run = await relay.agents.run("planner", {',
" input: prompt,",
' tools: ["search_docs", "run_sql"],',
" });",
" return run.output;",
"}",
].join("\n");
export function QuickstartCode() {
return <CodeBlock files={[{ lang: "ts", label: "TS", filename: "run.ts", code, highlight: "6-9" }]} />;
}files–
{ lang, label, filename, code, highlight? }[]One or more; several get a language switch.
defaultLang–
stringThe file shown first.
highlight–
"6-11"Lines marked at first, per file.
wrap–
booleanWrap instead of scrolling sideways.
onCopy–
(code) => voidAfter copying.
components/ui/notchset/code-block.tsx