Mac Terminal

A draggable, interactive macOS-style terminal window with neofetch output, editable input, command history, and dark/light mode support.

The MacTerminal component is a pixel-perfect recreation of the macOS Terminal.app window. It features the classic traffic light buttons, a draggable title bar, a fully interactive command line with history navigation, and a built-in neofetch-style system info display with Apple ASCII art. The terminal supports both dark and light modes automatically.

Preview

utkarsh — -zsh — 80x24
utkarsh@dev_ ~ %

Usage

Installation

$ pnpm dlx shadcn add https://klarden.vercel.app/r/mac-terminal.json

Basic Example

import { MacTerminal } from "@/components/klarden-ui/mac-terminal";

export default function App() {
  return (
    <MacTerminal
      username="Kipp"
      hostname="lil-boi.local"
      shell="zsh"
      width={680}
      height={400}
      draggable={true}
      showNeofetch={true}
    />
  );
}

Custom Command Handler

import { MacTerminal } from "@/components/klarden-ui/mac-terminal";

export default function App() {
  return (
    <MacTerminal
      username="dev"
      hostname="macbook.local"
      onCommand={(cmd) => {
        if (cmd === "hello") return ["Hello, World! 🚀"];
        if (cmd === "status") return ["All systems operational ✅"];
        return undefined; // fallback to built-in commands
      }}
    />
  );
}

Built-in Commands

The terminal ships with a set of built-in shell commands. You can extend or override them using the onCommand prop.

PropTypeDefaultDescription
neofetchcommand—Displays the Apple ASCII art alongside system information.
clearcommand—Clears the entire terminal screen.
whoamicommand—Prints the currently configured username.
hostnamecommand—Prints the currently configured hostname.
pwdcommand—Shows the simulated current working directory.
datecommand—Prints the current local date and time.
lscommand—Lists mock home directory contents.
echo <text>command—Echoes the provided text back to the terminal.
unamecommand—Displays simulated system kernel information.
helpcommand—Lists all available built-in commands.

Properties

PropTypeDefaultDescription
usernamestring"Kipp"The username displayed in the terminal prompt.
hostnamestring"lil-boi.local"The hostname displayed in the terminal prompt.
shellstring"zsh"The shell name shown in the title bar.
titlestringundefinedOverride the title bar text. Defaults to 'username — -shell — 80x24'.
widthnumber680The initial width of the terminal window in pixels.
heightnumber420The initial height of the terminal body in pixels.
draggablebooleantrueWhether the terminal window can be dragged by its title bar.
showNeofetchbooleantrueWhether to display the neofetch output when the terminal mounts.
neofetchInfo{ label: string; value: string }[]DEFAULT_NEOFETCH_INFOCustom system info entries for the neofetch display.
initialLinesTerminalLine[]undefinedPre-fill the terminal with custom lines instead of the default neofetch output.
onCommand(command: string) => string[] | undefinedundefinedCustom command handler. Return string[] of output lines, or undefined to fall through to built-in commands.
onClose() => voidundefinedCallback when the red close button is clicked.
onMinimize() => voidundefinedCallback when the yellow minimize button is clicked.
onMaximize() => voidundefinedCallback when the green maximize button is clicked.
classNamestring—Additional CSS classes for the outer container.