@termdraw/opentui
v0.3.5
Published
OpenTUI components and renderables for embedding termDRAW in terminal apps.
Maintainers
Readme
@termdraw/opentui
@termdraw/opentui provides the embeddable OpenTUI components and renderables behind termDRAW for terminal apps that want an in-process drawing surface.
What it provides
TermDrawAppfor the full chrome with header, palette, footer, and splashTermDrawEditorfor the bare editor surfaceTermDrawas an alias forTermDrawApp- renderables and helpers for saved output and CLI help text
Install
npm install @termdraw/opentui @opentui/core @opentui/react reactQuick start
import { 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
TermDrawAppRenderableTermDrawEditorRenderableTermDrawRenderableformatSavedOutputbuildHelpTextregisterTermDrawComponentregisterTermDrawComponents
Standalone app
If you want the packaged terminal app instead of the embeddable OpenTUI surface:
npm install --global @termdraw/appThen run:
termdrawContributing
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
Security
Please report security issues privately through GitHub Security Advisories:
License
MIT. See LICENSE.
