What problem does it solve?
Enables developers to build consistent, interactive terminal UI components for pi extensions so tools behave reliably across overlays, widgets, editors, and footers, removing ad-hoc mistakes like overflowing lines, broken theming, and improper focus/IME handling.
Core Features & Use Cases
- Component contract: Defines render(width) returning lines under width, optional handleInput, and invalidate lifecycle to support caching and theme rebuilds.
- Built-in primitives & rendering: Text, Box, Container, SelectList, Input, Editor, Image, and custom borders for assembling complex layouts and tool result renderers.
- Overlays, persistent UI, and custom editors: Anchorable overlays, persistent widgets/status/footer APIs, and a CustomEditor base for integrating editors with app keybindings and IME support.
- Use Case: Create an overlay file picker that appears centered on large terminals, uses theming for success/error states, preserves IME cursor positioning, and returns structured selection to a calling tool.
Quick Start
Implement a Component with render, handleInput, and invalidate, then register it via ctx.ui.custom to display as an overlay or persistent widget.