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] →cd projects and cd .. and watch the prompt and the title change.Placeholders
| Placeholder | Value | Example |
|---|---|---|
{cwd} | The current folder’s name, ~ at the root | projects |
{path} | The full current path, starting at ~ | ~/projects/web |
{user} | The username prop | guest |
{host} | The hostname prop | one-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(defaultguest) is used bywhoami,{user},ls -landneofetch.hostname(defaultone-terminal) is used by{host}andneofetch.shellName(defaultzsh) starts shell errors, like real shells do, and is shown byneofetch:
guest@~:$ upper
zsh: command not found: upperChange 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 — projectstitleBarCwd controls what gets added, and titleBarSeparator (default " — ") what goes in between:
titleBarCwd | Title |
|---|---|
"basename" (default) | My Terminal — projects |
"full" | My Terminal — ~/work/projects |
"none" | My Terminal |
<Terminal windowChrome={['linux', { titleBarText: 'portfolio', titleBarSeparator: ': ', titleBarCwd: 'full' }]} />
// portfolio: ~/work/projectsFull 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/projectsThe title bar supports the same placeholders as the prompt.