Skip to Content
DocsPrompt & Title Bar

Prompt & Title Bar

Prompt

The prompt prop is a template. The default is {user}@{cwd}:$ , which looks like guest@projects:$ .

<Terminal prompt="{user}@{host}:{path}$ " /> // ines@portfolio:~/projects$ <Terminal prompt="❯ " /> // ❯ <Terminal prompt="[{cwd}] → " /> // [projects] →
Run cd projects and cd .. and watch the prompt and the title change.

Placeholders

PlaceholderValueExample
{cwd}The current folder’s name, ~ at the rootprojects
{path}The full current path, starting at ~~/projects/web
{user}The username propguest
{host}The hostname propone-terminal

The prompt updates as you cd around. Each line in the scrollback keeps the prompt it was typed at, like a real terminal.

End the prompt with a space ("$ ") so typed text doesn’t touch it.

Username, hostname and shell name

<Terminal username="ines" hostname="portfolio" shellName="bash" />
  • username (default guest) is used by whoami, {user}, ls -l and neofetch.
  • hostname (default one-terminal) is used by {host} and neofetch.
  • shellName (default zsh) starts shell errors, like real shells do, and is shown by neofetch:
guest@~:$ upper zsh: command not found: upper

Change it to anything you like, e.g. shellName="bash" gives bash: command not found: upper.

Welcome message

welcomeMessage is shown above the first prompt. clear and Ctrl+L remove it.

<Terminal welcomeMessage={"Welcome to my site!\nType 'help' to see what you can do."} />

It’s a string, and \n starts a new line.

Title bar

Like real terminals on macOS and Linux, the title follows the current directory. With no titleBarText, the title is just the folder name (~ at the root).

Custom text plus the directory

When you set titleBarText, the directory is added after it:

<Terminal windowChrome={['mac', { titleBarText: 'My Terminal' }]} /> // My Terminal — projects

titleBarCwd controls what gets added, and titleBarSeparator (default " — ") what goes in between:

titleBarCwdTitle
"basename" (default)My Terminal — projects
"full"My Terminal — ~/work/projects
"none"My Terminal
<Terminal windowChrome={['linux', { titleBarText: 'portfolio', titleBarSeparator: ': ', titleBarCwd: 'full' }]} /> // portfolio: ~/work/projects

Full control with placeholders

If titleBarText contains a placeholder, nothing is added automatically. You decide exactly where things go:

<Terminal windowChrome={['linux', { titleBarText: '{user}@{host}: {path}' }]} /> // ines@portfolio: ~/work/projects

The title bar supports the same placeholders as the prompt.

Last updated on