For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Terminal

A live command runner that streams shell commands and output with typewriter animation.

Run the checks, then build the app.
> acme-chat@0.1.0 lint
> eslint .
> acme-chat@0.1.0 test
> vitest run

 ✓ lib/ai.test.ts (6 tests) 41ms
 ✓ components/chat.test.tsx (9 tests) 212ms

 Test Files  2 passed (2)
      Tests  15 passed (15)
> acme-chat@0.1.0 build
> next build

   ▲ Next.js 16.3.0
   Creating an optimized production build ...
 ✓ Compiled successfully in 4.2s
 ✓ Generating static pages (12/12)

Route (app)                Size  First Load JS
┌ ○ /                     1.9 kB       112 kB
└ ƒ /api/chat              141 B       102 kB

Lint and tests pass, and the build compiled both routes.

Terminal renders a list of shell commands as collapsible trace rows. Each command streams character by character, output appears line by line, and a spinner flips to a checkmark when the command finishes.

Built on top of Trace and Code Block, so the visual language stays consistent with the rest of the registry.

Installation

Usage

terminal.tsx
import { Terminal, TerminalCommand } from "@/components/ui/terminal";
terminal.tsx
<Terminal>
  <TerminalCommand command="npm run build" output="✓ compiled successfully" />
</Terminal>

Anatomy

A terminal has three visible parts.

  • Trace list — the outer Trace container, one row per command
  • Trigger row — icon, spinner or checkmark, and the command text
  • Output panel — collapsible CodeBlock that streams stdout

Examples

Error output

Mark a TraceLine with status="error" to turn the title red. The collapsible body still uses CodeBlock — anything that fits inside a TraceCollapsibleContent works.

Ran pnpm install
> acme-chat@0.1.0 lint
> eslint .

app/api/chat/route.ts
  14:7  error  'model' is assigned a value but never used  no-unused-vars

components/chat.tsx
  42:5  error  React Hook useEffect has a missing dependency: 'messages'  react-hooks/exhaustive-deps

✖ 2 problems (2 errors, 0 warnings)

 ELIFECYCLE  Command failed with exit code 1.

Full demo

The preview on this page shows the terminal primitive composing with useChat, createChat, and transport from @frakment/ai. It streams three commands and uses TraceCollapsible for auto-expand during streaming and manual toggle afterwards.

The composition pulls @ai-sdk/react, ai, and every UI primitive it uses. Follow the Chat tutorial for the wiring pattern, or replace createChat with your own backend that streams data-terminal parts.

In Context

Build output

Run the checks, then build the app.
> acme-chat@0.1.0 lint
> eslint .
> acme-chat@0.1.0 test
> vitest run

 ✓ lib/ai.test.ts (6 tests) 41ms
 ✓ components/chat.test.tsx (9 tests) 212ms

 Test Files  2 passed (2)
      Tests  15 passed (15)
> acme-chat@0.1.0 build
> next build

   ▲ Next.js 16.3.0
   Creating an optimized production build ...
 ✓ Compiled successfully in 4.2s
 ✓ Generating static pages (12/12)

Route (app)                Size  First Load JS
┌ ○ /                     1.9 kB       112 kB
└ ƒ /api/chat              141 B       102 kB

Lint and tests pass, and the build compiled both routes.

Failed command

Ran pnpm install
> acme-chat@0.1.0 lint
> eslint .

app/api/chat/route.ts
  14:7  error  'model' is assigned a value but never used  no-unused-vars

components/chat.tsx
  42:5  error  React Hook useEffect has a missing dependency: 'messages'  react-hooks/exhaustive-deps

✖ 2 problems (2 errors, 0 warnings)

 ELIFECYCLE  Command failed with exit code 1.

API Reference

TerminalCommand

PropTypeDefaultDescription
command*string—The shell command to display.
output*string—Combined stdout as a newline-joined string.
status
"running""done""error"
"done"Controls the trigger icon. Running shows a spinner, done shows a checkmark, error shows a destructive icon.
defaultOpenbooleantrueWhether the output panel is expanded on mount.
typewriterbooleantrueStream the command text character by character.
typeSpeednumber24Milliseconds between characters when typing.

Terminal

Extends React.ComponentProps<"div">. Renders as a Trace container. No custom props — pass TerminalCommand children.

Accessibility

  • The trigger uses CollapsibleTrigger, so keyboard navigation works with Tab and Enter/Space.
  • The trigger row exposes the command text as its accessible label.
  • Icons are decorative and inherit aria-hidden from lucide defaults.
  • Output renders inside a focusable <pre> — screen readers can select and copy stdout.

Best Practices

  • Collapse by default. Open the terminal only while a command is streaming.
  • Cap the output height. max-h-64 on CodeBlockContent scrolls long logs.
  • Label the command, not the exit. "Ran pnpm build", not "Command complete".
  • Do not embed a live terminal. This primitive renders scripted output; for interactive shells, link out.