# Terminal window

> A terminal-style transcript with selectable command lines, output, and text labels for errors.

- Kind: ui · Category: Layout and media · Interactivity: none
- Install: `npx shadcn@latest add @haze/terminal-window`
- File: `src/components/haze/ui/terminal-window.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/terminal-window

## Use when
- Documentation shows a sequence of commands and their output
- A developer-facing example needs a compact shell transcript

## Avoid when
- People primarily need to copy one command. Use snippet.
- The page needs a running terminal with executable input.

## Alternatives
- [snippet](https://hazeui.com/ui/snippet.md)
- [code-block](https://hazeui.com/ui/code-block.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| label | `string` | "Release check" | no | Visible figure caption. |
| prompt | `string` | "$" | no | Decorative prefix for command lines. |
| lines | `{ text: string; kind?: "command" \| "output" \| "success" \| "error" }[]` |  | no | Transcript lines in order. The default kind is output. |
| class | `string` |  | no | Additional classes on the figure. |

## Accessibility
- The transcript is ordinary text. Screen readers get command and error labels.
- Use meaningful success and error text alongside the color.

## Agent prompts

### Install and use

Install the Haze UI component "Terminal window" with `npx shadcn@latest add @haze/terminal-window`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import TerminalWindow from "@/components/haze/ui/terminal-window.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/terminal-window.md

### Customize with real content

Adapt the Haze terminal-window ui for our product. Replace the demo values of these props with our real content: label, prompt, lines, class. Keep the layout, the heading level rules and these accessibility details: The transcript is ordinary text. Screen readers get command and error labels. Use meaningful success and error text alongside the color. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using terminal-window, check it fits: use it when documentation shows a sequence of commands and their output; a developer-facing example needs a compact shell transcript. Avoid it when people primarily need to copy one command. use snippet.; the page needs a running terminal with executable input.. Alternatives: @haze/snippet, @haze/code-block.

## Example requests that should lead here
- Display a short pnpm release check transcript with commands and their output.

## Source

```astro
---
import { Check, Terminal } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

type Line = { text: string; kind?: "command" | "output" | "success" | "error" };
interface Props {
  label?: string;
  prompt?: string;
  lines?: Line[];
  class?: string;
}

const {
  label = "Release check", prompt = "$", class: className,
  lines = [
    { text: "pnpm verify", kind: "command" },
    { text: "Checking build output…" },
    { text: "Verification passed", kind: "success" },
  ],
} = Astro.props;
const classes = {
  command: "text-card-foreground",
  output: "text-muted-foreground",
  success: "text-success",
  error: "text-destructive",
};
---

<figure class={cn("min-w-0 overflow-hidden rounded-xl border border-border bg-card text-card-foreground", className)}>
  <figcaption class="flex min-w-0 items-center gap-2 border-b border-border min-h-11 bg-muted/40 px-4 py-1.5 text-[0.8125rem]/5 font-medium">
    <Terminal aria-hidden="true" class="size-4 shrink-0 text-muted-foreground" />
    <span class="min-w-0 wrap-anywhere">{label}</span>
  </figcaption>
  <ol class="grid min-w-0 gap-1 px-4 py-3.5 font-mono text-[0.8125rem]/5">
    {lines.map(({ text, kind = "output" }) => (
      <li class={cn("min-w-0 whitespace-pre-wrap wrap-anywhere", classes[kind])}>
        {kind === "command" && <><span aria-hidden="true" class="text-muted-foreground">{prompt} </span><span class="sr-only">Command: </span></>}
        {kind === "success" && <Check aria-hidden="true" class="mr-1 inline size-3.5 align-text-bottom" />}
        {kind === "error" && <span class="font-medium">Error: </span>}
        <code>{text}</code>
      </li>
    ))}
  </ol>
</figure>
```
