Terminal - Animated Terminal Component

A customizable terminal component with typing animation, multiple themes (macOS, Windows, Linux), and support for various output types like commands, success, error, and info messages.

Installation

npx shadcn@latest add "https://ui-struct.vercel.app/r/terminal"

Basic Usage

import Terminal from '@/components/ui/terminal';
export default function MyComponent() {
return (
<Terminal
lines={[
{ type: 'command', content: 'npm install struct-ui', prompt: '~' },
{ type: 'output', content: 'Installing dependencies...', delay: 500 },
{ type: 'success', content: '✓ Installed successfully', delay: 800 },
]}
title="Terminal"
theme="macos"
/>
);
}

Preview

Terminal

Themes

The terminal supports multiple OS themes - macOS, Windows, Linux, and a minimal theme.

macOS Theme
Terminal — bash
Windows Theme
─□×
Command Prompt
Linux Theme
Terminal
Minimal Theme
shell

Multi-line Commands

Perfect for showcasing git workflows, file operations, or any multi-step commands.

Terminal — git

NPM Installation

Show package installation with detailed output.

Terminal — npm

Error Handling

Demonstrate build errors and their solutions.

Terminal — build

Loop Animation

Perfect for hero sections or showcasing installation commands.

Terminal

Line Numbers

Enable line numbers for code output or file content display.

Terminal — cat

Deployment Demo

Show deployment workflows with progress updates.

Terminal — vercel

Props

PropTypeDefaultDescription
linesTerminalLine[]Default sample linesArray of terminal lines to display
titlestring'Terminal'Title shown in the terminal header
theme'macos' | 'windows' | 'linux' | 'minimal''macos'Terminal theme/style
typingSpeednumber50Typing speed in milliseconds per character
showLineNumbersbooleanfalseShow line numbers on the left
autoScrollbooleantrueAuto-scroll to bottom as content appears
loopbooleanfalseLoop the animation when complete
startDelaynumber500Delay before typing starts (ms)
heightstring'auto'Height of the terminal content area
classNamestring''Additional CSS classes

TerminalLine Interface

interface TerminalLine {
type: 'command' | 'output' | 'error' | 'success' | 'info';
content: string;
prompt?: string; // Directory shown before command (e.g., '~', '~/project')
delay?: number; // Delay before this line appears (ms)
}

Line Types

TypeDescriptionColor
commandUser input command (with typing animation)White/Default
outputStandard outputGray
errorError messagesRed
successSuccess messagesGreen
infoInformational messagesBlue

Themes Overview

ThemeStyleUse Case
macosmacOS-style with traffic light buttonsDefault, modern look
windowsWindows Command Prompt styleWindows-focused demos
linuxUbuntu-inspired purple themeLinux/Ubuntu content
minimalClean, borderless dark themeMinimalist designs

Tips

  • Use delay on lines to create realistic timing between commands and their output
  • Set loop={true} for hero section animations
  • Combine with startDelay to sync with page animations
  • Use showLineNumbers when displaying file contents
  • The prompt prop customizes the directory shown before commands (default: ~)