Astro components Terminal
// Terminal

Terminal

Astro wrapper for a .talos-terminal transcript, from a lines array or slotted line elements.

Terminal renders the terminal transcript: a focusable <div class="talos-terminal" role="region"> of .talos-terminal__line rows. Pass lines for a static transcript, or put .talos-terminal__line elements in the default slot (for lines a script appends). Command lines draw the prompt glyph as generated content, so copying a command copies only the command. The CSS lives in talos-terminal.css (in all.css); see the Terminal CSS page for the class reference.

Default

PREVIEW
bun run build
dist/wc/index.js 42 kB
3 files skipped
1 deprecated class in use
lint: 1 error
retrying with --fix
build complete

Wrapped

PREVIEW
curl -s https://talos-ui.shelfwood.co/llms.txt | head -n 20
A long output line that wraps inside the transcript instead of scrolling it sideways.
---
import Terminal from "@j_shelfwood/talos-ui/astro/Terminal.astro";
---
<Terminal label="Build" cursor lines={[
  { type: "cmd", text: "bun run build" },
  { type: "out", text: "dist/wc/index.js  42 kB" },
  { type: "ok", text: "build complete" },
]} />

Props

PropTypeDefaultMeaning
linesTerminalLine[]nonethe transcript; without it the default slot renders
wrapbooleanfalsewraps long lines instead of scrolling them sideways
cursorbooleanfalseappends a prompt line with a blinking cursor
labelstring"Terminal"accessible name of the region
classstringnoneextra classes on the <div>
...restHTMLAttributes<"div">noneforwarded to the <div>

TerminalLine is { type, text } with type one of "cmd", "out", "ok", "warn", "err", "dim" or "hl"; each renders .talos-terminal__line--<type>.