Code

Inline code and code blocks.

Inline

Code marks a literal value inside prose: a prop, a parameter, a file name. It is mono at 0.92em on neutral-100.

Set max_call_duration to end calls after a limit, or pass voice_id to override the agent's voice.

Code block

CodeBlock highlights a snippet, fills its container, and scrolls long lines horizontally. Pass the text as code or as children.

import { Button } from "@smallest-inc/ui";

export function DeployAgent({ onDeploy }: { onDeploy: () => void }) {
  return (
    <Button variant="primary" onClick={onDeploy}>
      Deploy agent
    </Button>
  );
}

Languages

Set language for highlighting. ts, tsx, js, jsx, sh, bash and zsh map to their base grammars; css, json, python, go, rust and diff are supported directly.

pnpm add @smallest-inc/ui
pnpm smallest -- button
@import "tailwindcss";
@import "@smallest-inc/ui/styles.css";
{
  "event": "call.completed",
  "call_id": "CALL-4506a1f2",
  "duration_seconds": 65,
  "status": "completed"
}

Line numbers

Line numbers are on by default. Turn them off for one-line commands and short output.

import { Pill } from "@smallest-inc/ui";

<Pill variant="positive">Live</Pill>;
import { Pill } from "@smallest-inc/ui";

<Pill variant="positive">Live</Pill>;

Without copy

The copy button is on by default. Set showCopy={false} for output people read but never paste.

Deployed nova-sales-assistant to +1 (415) 555-0198
Status: live

Best practices

When to use

  • Use Code for literal values inside prose (props, parameters, file names) and CodeBlock for snippets, commands and payloads people may copy.
  • Use regular text for prose, even when it mentions a technical concept.

Behavior

  • Set language for highlighting: ts, tsx, js, jsx, sh, bash and zsh map to their base grammars; css, json, python, go, rust and diff are supported directly.
  • CodeBlock fills its container and scrolls long lines horizontally. Turn off showLineNumbers for one-line commands and short output; set showCopy={false} for output people read but never paste.

Content

  • Use the mono font and keep capitalisation, punctuation and whitespace exact in copyable values. Show runnable snippets with real names, not placeholders like foo.