@rilaptra/tui
v1.0.0
Published
Zero-dependency terminal UI toolkit for Bun — interactive prompts, native OS notifications, progress bars, an editor, and more.
Maintainers
Readme
@rilaptra/tui
A zero-dependency terminal UI toolkit for Bun — interactive prompts, native OS notifications, progress bars, a full-screen editor, and more. Every component is crafted for instant startup and buttery-smooth rendering, using nothing but Bun's native APIs and raw ANSI escape sequences.
Extracted from and battle-tested in digester.
Features
- Zero dependencies — no chalk, no ink, no react. Just Bun.
- 12 production-grade components covering the whole CLI interaction lifecycle.
- Native OS notifications with the full Windows Toast API (buttons, progress bars, images, sounds, scenarios, in-place updates) plus macOS and Linux support.
- Smooth rendering — stable-height viewports, auto-scrolling pagination, and flicker-free redraws.
- Fully typed & documented — strict TypeScript with JSDoc on every export, plus a structured API reference.
Components
| Component | One-liner | Docs |
| --- | --- | --- |
| Confirm | Yes/No confirmation toggle | docs/components/Confirm.md |
| TextPrompt | Text input with validation & password masking | docs/components/TextPrompt.md |
| Select | Single-select menu with grids & pagination | docs/components/Select.md |
| MultiSelect | Checklist with min-selection validation | docs/components/MultiSelect.md |
| AutoComplete | Token-aware input with live suggestions | docs/components/AutoComplete.md |
| TreeSelect | Interactive directory tree browser | docs/components/TreeSelect.md |
| CommandPalette | Full-screen fuzzy command launcher | docs/components/CommandPalette.md |
| Editor | Full-screen multi-line text editor | docs/components/Editor.md |
| SpinNumber | Numeric stepper with manual typing | docs/components/SpinNumber.md |
| ProgressBar | Styled progress bar with gradients & ETA | docs/components/ProgressBar.md |
| Notification / ToastBuilder | Cross-platform native OS notifications | docs/components/Notification.md |
| core (ANSI, c, useInput, ...) | Low-level primitives | docs/components/core.md |
Requirements
- Bun v1.1.0 or newer — the library uses
Bun.color,Bun.stringWidth, andBun.spawn. - A TTY (interactive terminal) for the prompt components.
Installation
bun add @rilaptra/tuiQuick start
import { Confirm, Select, ToastBuilder } from "@rilaptra/tui";
// 1. Ask a question.
const deploy = await new Confirm({ title: "Deploy to production?" }).run();
// 2. Pick from a list.
const env = await new Select<string>()
.title("Target environment")
.add("Staging", "staging", { desc: "Safe to break" })
.add("Production", "production", { desc: "Break carefully" })
.run();
// 3. Tell the user it worked — with a native OS notification.
if (deploy) {
await ToastBuilder.create(`Deployed to ${env} ✅`)
.setTitle("Deploy")
.setAppName("My CLI")
.setSound("Default")
.show();
}Try the examples
The repository ships with a runnable demo for every component — including a notification showcase that walks through all ten toast scenarios (live progress updates, buttons, images, alarms, and more).
git clone https://github.com/Rilaptra/tui.git
cd tui
bun install
bun run example # interactive gallery of every component
bun run example notification # jump straight to the notification showcase
bun run example select editor # run specific demos in sequenceSee docs/examples.md for the full list of example commands.
Documentation
- DOCS.md — the structured API reference index and core concepts.
- docs/components/ — one deep-dive page per component.
- docs/examples.md — running and understanding the examples.
License
MIT © 2026 Rilaptra
