Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 234 additions & 0 deletions components/terminal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
---
title: "Terminal"
description: "Display command-line interfaces and terminal output with syntax highlighting"
icon: "terminal"
---

import IconsOptional from "/snippets/icons-optional.mdx";

**THIS IS A GATED ENTERPRISE FEATURE**

Use the terminal widget to display command-line interfaces, terminal sessions, and code execution output. The terminal widget provides a realistic terminal appearance with customizable themes and interactive features.

## Basic terminal

<Terminal>
$ npm install @mintlify/terminal
✓ Package installed successfully
$ npm start
Starting development server...
Server running on http://localhost:3000
</Terminal>

```mdx Terminal example
<Terminal>
$ npm install @mintlify/terminal
✓ Package installed successfully
$ npm start
Starting development server...
Server running on http://localhost:3000
</Terminal>
```

## Terminal with title

Add a title to provide context for the terminal session.

<Terminal title="Development Setup">
$ git clone https://github.com/your-repo/project.git
Cloning into 'project'...
$ cd project
$ npm install
Installing dependencies...
</Terminal>

```mdx Terminal with title
<Terminal title="Development Setup">
$ git clone https://github.com/your-repo/project.git
Cloning into 'project'...
$ cd project
$ npm install
Installing dependencies...
</Terminal>
```

## Terminal themes

Customize the appearance with different terminal themes.

### Dark theme (default)

<Terminal theme="dark">
$ ls -la
total 24
drwxr-xr-x 4 user staff 128 Dec 1 10:30 .
drwxr-xr-x 3 user staff 96 Dec 1 10:29 ..
-rw-r--r-- 1 user staff 1024 Dec 1 10:30 README.md
-rw-r--r-- 1 user staff 2048 Dec 1 10:30 package.json
</Terminal>

### Light theme

<Terminal theme="light">
$ whoami

Check warning on line 73 in components/terminal.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

components/terminal.mdx#L73

Did you really mean 'whoami'?
developer
$ pwd

Check warning on line 75 in components/terminal.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

components/terminal.mdx#L75

Did you really mean 'pwd'?
/home/developer/projects
</Terminal>

```mdx Terminal themes
<Terminal theme="dark">
$ ls -la
total 24
drwxr-xr-x 4 user staff 128 Dec 1 10:30 .
</Terminal>

<Terminal theme="light">
$ whoami
developer
</Terminal>
```

## Interactive terminal

Enable interactive features like copy buttons and command highlighting.

<Terminal interactive title="API Testing">
$ curl -X GET https://api.example.com/users
{
"users": [
{"id": 1, "name": "John Doe"},
{"id": 2, "name": "Jane Smith"}
]
}
$ curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "New User"}'
{"id": 3, "name": "New User", "created": true}
</Terminal>

```mdx Interactive terminal
<Terminal interactive title="API Testing">
$ curl -X GET https://api.example.com/users
{
"users": [
{"id": 1, "name": "John Doe"},
{"id": 2, "name": "Jane Smith"}
]
}
</Terminal>
```

## Multi-step commands

Show complex workflows with multiple commands and outputs.

<Terminal title="Docker Deployment">
$ docker build -t myapp .

Check warning on line 127 in components/terminal.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

components/terminal.mdx#L127

Did you really mean 'myapp'?
Sending build context to Docker daemon 2.048kB
Step 1/5 : FROM node:16-alpine
---> 1234567890ab
Step 2/5 : WORKDIR /app
---> Running in abcdef123456
---> fedcba654321
Successfully built fedcba654321
Successfully tagged myapp:latest

Check warning on line 135 in components/terminal.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

components/terminal.mdx#L135

Did you really mean 'myapp'?

$ docker run -p 3000:3000 myapp
Server starting...
✓ Application ready on port 3000
</Terminal>

```mdx Multi-step terminal
<Terminal title="Docker Deployment">
$ docker build -t myapp .
Sending build context to Docker daemon 2.048kB
Step 1/5 : FROM node:16-alpine
---> 1234567890ab
Successfully tagged myapp:latest

$ docker run -p 3000:3000 myapp
Server starting...
✓ Application ready on port 3000
</Terminal>
```

## Error handling

Display error messages and troubleshooting information.

<Terminal title="Debugging Session">
$ npm test
> test
> jest

FAIL src/components/Button.test.js
✕ should render correctly (5ms)

Error: Cannot find module 'react-testing-library'
at Object.<anonymous> (src/components/Button.test.js:2:1)

$ npm install --save-dev @testing-library/react
+ @testing-library/[email protected]
added 1 package

$ npm test
> test
> jest

PASS src/components/Button.test.js
✓ should render correctly (12ms)

Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
</Terminal>

```mdx Error handling terminal
<Terminal title="Debugging Session">
$ npm test
FAIL src/components/Button.test.js
✕ should render correctly (5ms)

Error: Cannot find module 'react-testing-library'

$ npm install --save-dev @testing-library/react
+ @testing-library/[email protected]
added 1 package

$ npm test
PASS src/components/Button.test.js
✓ should render correctly (12ms)
</Terminal>
```

## Properties

<ResponseField name="title" type="string">
Optional title displayed at the top of the terminal window.
</ResponseField>

<ResponseField name="theme" type="string" default="dark">
Terminal color theme. Options: `dark`, `light`, `matrix`, `retro`.
</ResponseField>

<ResponseField name="interactive" type="boolean" default="false">
Enable interactive features like copy buttons and command highlighting.
</ResponseField>

<ResponseField name="height" type="string">
Set a fixed height for the terminal (e.g., `300px`, `20rem`).
</ResponseField>

<ResponseField name="maxHeight" type="string">
Set a maximum height with scrolling for long output.
</ResponseField>

<ResponseField name="showLineNumbers" type="boolean" default="false">
Display line numbers for each line of output.
</ResponseField>

<ResponseField name="copyable" type="boolean" default="true">
Allow users to copy terminal content to clipboard.
</ResponseField>

<IconsOptional />
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"components/panel",
"components/steps",
"components/tabs",
"components/terminal",
"components/tooltips",
"components/update",
"components/banner"
Expand Down
Loading