Skip to content

Installation

ztui ships as a slim core with opt-in entry points, so you only install the dependencies for the features you actually use. The core entry pulls in no React and no heavy rendering engines.

Terminal window
bun add @huyz0/ztui
ImportWhat you getInstall alongside
@huyz0/ztuiCore: App, Widget, Screen, drivers, geometry, render, theme, animations, and the imperative widgets
@huyz0/ztui/reactThe React reconciler render + all JSX components and hooksbun add react react-reconciler
@huyz0/ztui/markdownMarkdown engine + MarkdownWidgetbun add marked
@huyz0/ztui/syntaxSyntax highlighting + SyntaxWidgetbun add prismjs
@huyz0/ztui/mermaidMermaid diagrams + MermaidWidgetbun add beautiful-mermaid

react and react-reconciler are required peerDependencies — they are the engine behind @huyz0/ztui/react, the primary way to build a ztui app, so install them alongside the package:

Terminal window
bun add @huyz0/ztui react react-reconciler

The remaining extras (marked, prismjs, beautiful-mermaid, sharp, opentype.js) are declared as optional peerDependencies — they are never installed automatically, and the widgets that need them throw an actionable error (or degrade gracefully) when missing. SVG-icon rasterization (Kitty/iTerm) uses an optional sharp; Seti file icons use an optional opentype.js; both fall back to Unicode glyphs when absent.

import { App } from "@huyz0/ztui";
import { Markdown, render } from "@huyz0/ztui/react";
import "@huyz0/ztui/markdown"; // registers the widget + pulls `marked`
import "@huyz0/ztui/syntax"; // optional: highlight fenced code via `prismjs`
const app = new App();
render(<Markdown># Hello, **ztui**</Markdown>, app.activeScreen);
app.run();
  • Bun (the primary runtime) or Node 18+.
  • A terminal for the terminal backend; any modern browser for the canvas backend.

Next: the Quick Start.