Sandbox Row
ProNewOne sandbox in a list: a copyable ID, its template, region and state, processor and memory meters, and pause, shell and kill, where kill asks for a second press.
Installation
pnpm dlx shadcn@latest add @viewport/sandbox-row
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| id* | stringThe sandbox's identifier, shown in a monospace face with a copy button. | — |
| template* | stringThe image or template it was started from. | — |
| state* | "running" | "starting" | "paused" | "failed" | "stopped" | — |
| region | stringWhere it runs and how long it has been up, already formatted. | — |
| uptime | string | — |
| cpu | numberProcessor and memory in use, from 0 to 100. | — |
| memory | number | — |
| onPauseChange | (paused: boolean) => void | — |
| onKill | () => voidStops the sandbox for good. The button asks for a second press first. | — |
| onOpen | () => voidOpens a shell or the logs. | — |
| className | string | — |
Accessibility
- State is written out beside the dot.
- Kill says what the second press will do and disarms when focus leaves.
- Meters are meter elements; a high reading is bold as well as red.
- Actions that do not apply are disabled, not removed.
- Respects prefers-reduced-motion.