Skip to Content
DocsAPI Reference

API Reference

Terminal Component

The main component of the library.

import { Terminal } from "one-terminal";

Props

PropTypeDefaultDescription
fileStructureDirectoryNodeRequiredThe virtual file system structure.
startPathstring"/"The initial working directory.
welcomeMessagestring""Message shown at the top of the terminal session.
promptstring"guest@{cwd}:$ "Command prompt template. Use {cwd} for current directory.
windowChromeWindowChromeStyle | object"mac"Window decoration style.
themeBuiltInTheme | object"dracula"Color theme for the terminal.
extraCommandsExtraCommandsundefinedCustom commands to extend functionality.
demoTerminalDemoConfigundefinedConfiguration for automated demo sequences.

Types

DirectoryNode

Represents a directory in the virtual file system.

type DirectoryNode = { kind: "directory"; entries: Record<string, FSNode>; };

FileNode

Represents a file (text or link).

type FileNode = TextFileNode | LinkFileNode; type TextFileNode = { kind: "file"; fileType: "text"; content: string; }; type LinkFileNode = { kind: "file"; fileType: "link"; href: string; label?: string; target?: "_blank" | "_self"; };
Last updated on