Summary
Add a TerminalGrid component (or similar high-level layout manager) that sits on top of <JabTerm> and provides:
- Tabbed terminals — Create, close, and switch between multiple terminal sessions via a tab bar.
- Split panes — Split any terminal horizontally or vertically to view multiple sessions side-by-side (VS Code / tmux style).
- State-aware tab colors — Each tab automatically reflects the terminal's current state through color coding:
- 🔵 Blue — Idle, waiting for user input
- 🟢 Green / Lime — Process is running
- 🟠 Orange — Errors detected in stderr
- ⚫ Gray — Disconnected / closed
Motivation
When embedding terminals in web applications (dashboards, AI agent UIs, DevOps panels), users almost always need multiple terminals with a way to organize them visually. Currently each <JabTerm> is independent, so the consuming app has to build its own tab bar, split logic, and state detection from scratch.
A first-party layout manager would make JabTerm a drop-in replacement for a full terminal experience.
Proposed API (rough sketch)
import { TerminalGrid } from 'jabterm/react';
<TerminalGrid
wsUrl="ws://localhost:3223"
defaultLayout={{
type: 'tabs',
children: [
{ id: 'main', title: 'Main' },
{ id: 'build', title: 'Build' },
{
type: 'split-h',
children: [
{ id: 'logs', title: 'Logs' },
{ id: 'tests', title: 'Tests' },
],
},
],
}}
tabColors={{
idle: '#6366f1', // indigo/blue
running: '#84cc16', // lime/green
error: '#f97316', // orange
disconnected: '#6b7280', // gray
}}
onLayoutChange={(layout) => saveToLocalStorage(layout)}
/>
State detection approach
Terminal state could be inferred by combining:
data-jabterm-state (already exists: connecting | open | closed) → maps to disconnected
- PTY child-process activity (server-side: is the foreground process running?) →
running vs idle
- stderr marker detection (opt-in, via ANSI escape or heuristic) →
error
Scope
Summary
Add a
TerminalGridcomponent (or similar high-level layout manager) that sits on top of<JabTerm>and provides:Motivation
When embedding terminals in web applications (dashboards, AI agent UIs, DevOps panels), users almost always need multiple terminals with a way to organize them visually. Currently each
<JabTerm>is independent, so the consuming app has to build its own tab bar, split logic, and state detection from scratch.A first-party layout manager would make JabTerm a drop-in replacement for a full terminal experience.
Proposed API (rough sketch)
State detection approach
Terminal state could be inferred by combining:
data-jabterm-state(already exists:connecting | open | closed) → maps todisconnectedrunningvsidleerrorScope
TerminalGridReact component with tab barCmd+Tnew tab,Cmd+Dsplit,Cmd+Wclose)onLayoutChangecallback