Terminal
A command the agent runs, with its output.
Derived from the AI reply's code block surface and its hover copy button. Notion AI runs no commands. The Shell title is hidden, and the copy button shows on hover like the code block's.
import { Button, Terminal } from "@replicas/ui";
const output = `> [email protected] lint
> eslint .
app/api/chat/route.ts
14:7 error 'model' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)`;
export default function TerminalDemo() {
return (
<Terminal.Root status="error" style={{ width: "100%", maxWidth: 480 }}>
<Terminal.Header>
<Terminal.Title>Shell</Terminal.Title>
<Terminal.Command>pnpm lint</Terminal.Command>
<Terminal.Status>Exit code 1</Terminal.Status>
<Terminal.Actions>
<Terminal.Copy value={output} />
<Button size="small" variant="ghost">
Retry
</Button>
</Terminal.Actions>
</Terminal.Header>
<Terminal.Output>{output}</Terminal.Output>
</Terminal.Root>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Terminal in the Notion style: the measured tokens, the CSS and the structure.
Show Prompt
# Notion Terminal
A command the agent runs, with its output.
Build a Terminal in this project that looks and behaves like Notion's. Measured from the running Notion app (notion.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.
Fidelity: Derived from the AI reply's code block surface and its hover copy button. Notion AI runs no commands. The Shell title is hidden, and the copy button shows on hover like the code block's.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--c-texPri` | `#2c2c2b` | `#f0efed` |
| `--c-texSec` | `#7d7a75` | `#ada9a3` |
| `--c-texTer` | `#a19e99` | `#7d7a75` |
| `--c-icoSec` | `#8e8b86` | `#ada9a3` |
| `--c-bacEle` | `#fff` | `#202020` |
| `--ca-bacSecTra` | `#42230308` | `#fcfcfc08` |
| `--ca-bacIntTra` | `#211b170d` | `#ffffff0e` |
| `--ca-bacIntPre` | `#211b171a` | `#ffffff1c` |
| `--c-redTexAccPri` | `#e56458` | `#e56458` |
| `--c-greTexAccPri` | `#46a171` | `#46a171` |
| `--c-shaOutMd` | `0px 8px 12px 0px #19191907, 0px 2px 6px 0px #19191907, 0px 0px 0px 1px #2a1c0012` | `0px 0px 0px 1px #383836, 0px 4px 12px -2px #19191914` |
| `--c-focSha` | `#2383e291 0px 0px 0px 1px inset, #2383e259 0px 0px 0px 2px` | `#2383e291 0px 0px 0px 1px inset, #2383e259 0px 0px 0px 2px` |
| `--font-monospace` | `SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace` | `SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace` |
| `--font-size-mini` | `12px` | `12px` |
| `--font-size-small` | `14px` | `14px` |
| `--radius-control` | `6px` | `6px` |
| `--radius-code` | `10px` | `10px` |
| `--duration-hover` | `100ms` | `100ms` |
| `--duration-highlight` | `20ms` | `20ms` |
| `--ease-hover` | `ease-in-out` | `ease-in-out` |
| `--ease-highlight` | `ease-in` | `ease-in` |
## CSS
Scoped under `[data-style="notion"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
@keyframes notion-terminal-cursor {
50% {
opacity: 0;
}
}
[data-style="notion"] {
.ui-terminal {
box-sizing: border-box;
display: flex;
flex-direction: column;
min-width: 0;
overflow: hidden;
border-radius: var(--radius-code);
background-color: var(--ca-bacSecTra);
color: var(--c-texSec);
font-family: inherit;
font-size: var(--font-size-small);
line-height: 20px;
}
.ui-terminal-header {
display: flex;
align-items: center;
gap: 8px;
min-height: 40px;
padding: 8px 8px 0 12px;
}
.ui-terminal-command {
flex: 1;
min-width: 0;
overflow: hidden;
color: var(--c-texPri);
font-family: var(--font-monospace);
font-size: 11.9px;
line-height: 20px;
text-overflow: ellipsis;
white-space: nowrap;
}
.ui-terminal-title {
display: none;
}
.ui-terminal-prompt {
color: var(--c-texTer);
user-select: none;
}
.ui-terminal-status {
flex-shrink: 0;
color: var(--c-texSec);
font-size: var(--font-size-mini);
line-height: 16px;
font-variant-numeric: tabular-nums;
}
.ui-terminal[data-status="error"] .ui-terminal-status {
color: var(--c-redTexAccPri);
}
.ui-terminal[data-status="done"] .ui-terminal-status {
color: var(--c-greTexAccPri);
}
.ui-terminal-actions {
display: flex;
flex-shrink: 0;
align-items: center;
gap: 4px;
}
.ui-terminal-copy {
box-sizing: border-box;
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
margin: 0;
padding: 0;
border: none;
border-radius: var(--radius-control);
background-color: var(--c-bacEle);
box-shadow: var(--c-shaOutMd);
color: var(--c-icoSec);
cursor: pointer;
outline: none;
opacity: 0;
transition:
opacity var(--duration-hover) var(--ease-hover),
background var(--duration-highlight) var(--ease-highlight);
& svg {
width: 16px;
height: 16px;
}
&:focus-visible {
box-shadow:
var(--c-shaOutMd),
var(--c-focSha);
}
@media (hover: hover) {
&:hover {
background-image: linear-gradient(var(--ca-bacIntTra), var(--ca-bacIntTra));
}
}
&:active {
background-image: linear-gradient(var(--ca-bacIntPre), var(--ca-bacIntPre));
}
&[data-copied] {
color: var(--c-greTexAccPri);
opacity: 1;
}
}
.ui-terminal:is(:hover, :focus-within) .ui-terminal-copy {
opacity: 1;
}
@media (hover: none) {
.ui-terminal-copy {
opacity: 1;
}
}
.ui-terminal-output {
box-sizing: border-box;
max-height: 220px;
margin: 0;
padding: 4px 12px 12px;
overflow: auto;
color: var(--c-texSec);
font-family: var(--font-monospace);
font-size: 11.9px;
line-height: 20px;
white-space: pre-wrap;
overflow-wrap: anywhere;
tab-size: 2;
outline: none;
&:focus-visible {
box-shadow: inset var(--c-focSha);
}
}
.ui-terminal[data-status="running"] .ui-terminal-output::after {
content: "";
display: inline-block;
width: 0.55em;
height: 1.1em;
margin-left: 1px;
background-color: var(--c-texSec);
vertical-align: text-bottom;
animation: notion-terminal-cursor 1s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) {
.ui-terminal[data-status="running"] .ui-terminal-output::after {
animation: none;
}
.ui-terminal-copy {
transition: none;
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Button as BaseButton } from "@base-ui/react/button";
import type { ComponentProps } from "react";
import { join, useCopy } from "./utils";
function Root({ className, status, ...props }: ComponentProps<"div"> & { status?: string }) {
return <div className={join("ui-terminal", className)} data-status={status} {...props} />;
}
function Header({ className, ...props }: ComponentProps<"div">) {
return <div className={join("ui-terminal-header", className)} {...props} />;
}
function Title({ className, ...props }: ComponentProps<"span">) {
return <span className={join("ui-terminal-title", className)} {...props} />;
}
function Command({ className, children, ...props }: ComponentProps<"code">) {
return (
<code className={join("ui-terminal-command", className)} {...props}>
<span className="ui-terminal-prompt" aria-hidden>
${" "}
</span>
{children}
</code>
);
}
function Status({ className, ...props }: ComponentProps<"span">) {
return <span className={join("ui-terminal-status", className)} {...props} />;
}
function Actions({ className, ...props }: ComponentProps<"div">) {
return <div className={join("ui-terminal-actions", className)} {...props} />;
}
type CopyProps = Omit<BaseButton.Props, "className" | "value"> & { className?: string; value: string };
function Copy({ className, value, onClick, ...props }: CopyProps) {
const { copied, copy } = useCopy(value);
return (
<BaseButton
className={join("ui-terminal-copy", className)}
aria-label={copied ? "Copied" : "Copy output"}
data-copied={copied || undefined}
onClick={(event) => {
onClick?.(event);
copy();
}}
{...props}
>
{copied ? (
<svg viewBox="0 0 16 16" fill="none" aria-hidden>
<path d="M4 8.5l2.5 2.5L12 5.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
) : (
<svg viewBox="0 0 16 16" fill="none" aria-hidden>
<rect x="5.5" y="5.5" width="7.5" height="7.5" rx="1.5" stroke="currentColor" strokeWidth="1.25" />
<path d="M10.5 3.5V3a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v5.5a1 1 0 0 0 1 1h.5" stroke="currentColor" strokeWidth="1.25" />
</svg>
)}
</BaseButton>
);
}
function Output({ className, ...props }: ComponentProps<"pre">) {
return <pre className={join("ui-terminal-output", className)} tabIndex={0} {...props} />;
}
export const Terminal = {
Root,
Header,
Title,
Command,
Status,
Actions,
Copy,
Output,
};
```
## Example
```tsx
import { Button, Terminal } from "@replicas/ui";
const output = `> [email protected] lint
> eslint .
app/api/chat/route.ts
14:7 error 'model' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)`;
export default function TerminalDemo() {
return (
<Terminal.Root status="error" style={{ width: "100%", maxWidth: 480 }}>
<Terminal.Header>
<Terminal.Title>Shell</Terminal.Title>
<Terminal.Command>pnpm lint</Terminal.Command>
<Terminal.Status>Exit code 1</Terminal.Status>
<Terminal.Actions>
<Terminal.Copy value={output} />
<Button size="small" variant="ghost">
Retry
</Button>
</Terminal.Actions>
</Terminal.Header>
<Terminal.Output>{output}</Terminal.Output>
</Terminal.Root>
);
}
```
## Foundations
The rest of the Notion style, as a skill: https://replicas.raphaelsalaja.com/skills/notion/SKILL.md