Skip to content

Terminal

A recorded CLI session: commands with a prompt, output with the CLI's own ✓/✗ marks. Copy copies the commands only.

DataServer-rendered

Examples

A switch and a refused switch

Long lines wrap by default, so a phone never scrolls sideways.

Light
sb use
sb use my-server staging
Refreshing staging…
✓ my-server now answers from staging · 9 tools (+1, −0)
  + get_alerts
sb use my-server prod
✗ Did not switch: prod failed to refresh (http): 502 Bad Gateway
  my-server still answers from staging
Dark
sb use
sb use my-server staging
Refreshing staging…
✓ my-server now answers from staging · 9 tools (+1, −0)
  + get_alerts
sb use my-server prod
✗ Did not switch: prod failed to refresh (http): 502 Bad Gateway
  my-server still answers from staging
Example
<Terminal
  title="sb use"
  lines={[
    { kind: 'cmd', text: 'sb use my-server staging' },
    { kind: 'dim', text: 'Refreshing staging…' },
    { kind: 'ok', text: 'my-server now answers from staging · 9 tools (+1, −0)' },
    { text: '  + get_alerts' },
  ]}
/>

Narrated session

`note` lines (`# …`) say what happens between commands, e.g. what an agent decided to do next. They are never copied.

Your agent
# serve the local build behind the same URL
sb dev my-server --port 3000
✓ my-server → local (relay) · 9 tools
# run the suite against it
sb eval run evals/my-server.yaml --target local
Example
<Terminal title="Your agent" lines={[{ kind: 'note', text: 'serve the local build behind the same URL' }, { kind: 'cmd', text: 'sb dev my-server --port 3000' }, …]} />

Column output, not wrapped

`wrap={false}` keeps each row whole; the transcript scrolls sideways and is keyboard reachable.

Inspector
sb calls --tail
14:02:07  my-server@local  get_forecast  ok  41 ms  1840→912  claude-code  call_7Hk2pQx9LmT4vR8sWd3e
Example
<Terminal title="Inspector" wrap={false} lines={[{ kind: 'cmd', text: 'sb calls --tail' }, { text: '14:02:07  my-server@local  …' }]} />

Usage

Usage
import { Terminal } from '@switchboard/ui'

<Terminal title?="Terminal" lines={[{ kind?: 'cmd' | 'out' | 'dim' | 'ok' | 'fail' | 'warn' | 'note', text }]} wrap?={true} copyLabel?="Copy commands" />

Props

Every component also takes mix, for css() and mixins applied after its own style.

Terminal

Terminal props
PropTypeDefaultDescription
lines*{ kind?: 'cmd' | 'out' | 'dim' | 'ok' | 'fail' | 'warn' | 'note'; text: string }[]–cmd gets a $ prompt; ok/fail/warn get ✓/✗/!; dim is secondary output; note is a # narration line between commands (never copied).
titleRemixNode"Terminal"Header label (the figcaption).
wrapbooleantruefalse: keep lines whole and scroll sideways (column output).
copyLabelstring | false"Copy commands"Copies the cmd lines, one per line. false hides the button.

Also accepts every <figure> attribute.

Accessibility

  • A <figure> named by its <figcaption>. The prompt and marks are real characters; the prompt is aria-hidden and not selectable, so copied text is the command alone.
  • Status is never colour alone: ok, fail and warn lines carry ✓, ✗ and !.
  • With wrap={false} the <pre> has tabindex="0" and a label, so keyboard users can scroll it.

Guidance

Do

  • Print what the CLI really prints, including hints and units.
  • Use `dim` for progress and hints, not for results.

Don’t

  • Use it for config files (use CodeBlock).
  • Invent output the CLI cannot produce.