A terminal drawing editor for developers who want editable diagrams, UI mocks, and text graphics without leaving the terminal.
@termdraw/app— the standalone terminal app with thetermdrawcommand@termdraw/opentui— embeddable OpenTUI components and renderables@termdraw/pi— Pi package that opens termDRAW in a Pi overlay
Requirements:
- Bun 1.3+
- A terminal with mouse support
npm install --global @termdraw/apptermdrawDraw something, then press Enter or Ctrl+S to write the result to stdout.
# save plain text directly to a file
termdraw --output diagram.txt
# export a fenced Markdown code block
termdraw --fenced > diagram.md
# show CLI help
termdraw --helptermDRAW! outputs terminal text, not SVG or bitmap graphics.
npm install @termdraw/opentui @opentui/core @opentui/react reactimport { createCliRenderer } from "@opentui/core";
import { createRoot } from "@opentui/react";
import { TermDrawApp } from "@termdraw/opentui";
const renderer = await createCliRenderer({
useMouse: true,
enableMouseMovement: true,
autoFocus: true,
screenMode: "alternate-screen",
});
createRoot(renderer).render(
<TermDrawApp
width="100%"
height="100%"
autoFocus
onSave={(art) => {
console.log(art);
}}
onCancel={() => {
renderer.destroy();
}}
/>,
);Also exported from @termdraw/opentui:
TermDrawAppTermDrawEditorTermDrawTermDrawAppRenderableTermDrawEditorRenderableTermDrawRenderableformatSavedOutputbuildHelpText
pi install npm:@termdraw/piThen inside Pi:
/termdraw
- App package:
packages/app - OpenTUI package:
packages/opentui - Pi package:
packages/pi
Contributions are welcome.
Before opening a PR:
- keep the change focused
- run
bun run check - add or update tests when editor behavior changes
- open an issue first for larger UX or API changes
Please report security issues privately through GitHub Security Advisories:
MIT. See LICENSE.
