資料展示

Animated Terminal

逐行打字模擬的命令列終端機,支援指令逐字輸入、輸出揭示與循環播放。

一個帶 macOS 視窗外觀的終端機,依序把每一行「打」出來:command 逐字輸入並帶提示符,output 與 comment 按節奏揭示,最後留下閃爍的待命游標。

把這個效果裝進你的專案

在專案資料夾執行指令,CLI 會加入原始碼與依賴套件,再依下方使用範例引用元件。

npx webberui@latest add animated-terminal

還沒有專案,或安裝遇到問題?看快速開始 →

Playground

即時調整 props、程式碼片段同步更新——直接試出你要的樣子再複製。

45
500
編輯中的呼叫預設屬性
<AnimatedTerminal/>

完整範例包含預覽的排版與資料。先安裝元件,再把範例檔貼入你的專案。

安裝

npx webberui@latest add https://webberui.com/r/animated-terminal.json

或在 components.json 設定 registries 後,改用 @webberui/animated-terminal 安裝。

使用

import { AnimatedTerminal } from "@/components/ui/animated-terminal";

<AnimatedTerminal
  title="webberui — zsh"
  lines={[
    { type: "command", text: "npm run build" },
    { type: "output", text: "Build complete in 4.2s", delay: 800 },
  ]}
/>;

每一筆 lines 的 type 可為 "command"、"output" 或 "comment";只有 command 會逐字輸入並顯示提示符,output 與 comment 會整行揭示。用 delay 為某一行加上開始前的停頓,模擬編譯或等待。

Props

Prop型別預設值說明
linesTerminalLine[]—要依序播放的行
typingSpeednumber45command 逐字輸入速度(毫秒/字)
lineDelaynumber500每行完成後、進入下一行前的停頓(毫秒)
startDelaynumber300整體開始前的延遲(毫秒)
promptstring"$"預設提示符
titlestring"bash"視窗標題列文字
showTrafficLightsbooleantrue顯示 macOS 紅黃綠三顆燈
loopbooleanfalse播完後循環重播
loopDelaynumber2200循環前的停頓(毫秒)

TerminalLine

欄位型別預設值說明
type"command" | "output" | "comment""command"行類型
textstring—該行文字內容
promptstring繼承 prompt覆寫此行的提示符(僅 command 有效)
delaynumber0此行開始前的額外停頓(毫秒)

可及性

  • 使用者系統開啟「減少動態效果」時,直接完整渲染所有行,游標不閃爍
  • 三顆視窗燈與游標皆帶 aria-hidden,不干擾螢幕閱讀器