--- name: opentui description: Build terminal UIs with OpenTUI/React. Use when creating screens, components, handling keyboard input, managing scroll, or navigating between views. Covers JSX intrinsics, useKeyboard, scrollbox patterns, and state preservation. --- # OpenTUI/React Quick Reference OpenTUI is a React renderer for terminal UIs using Yoga layout (like React Native). **NOT React DOM or Ink.** ## Version Info - **Current:** 0.1.69 (updated), **Latest:** 0.1.69 - **Context repo:** `.context/repos/opentui` (run `bun run sync-context` if missing) ## Core Imports ```typescript import { useKeyboard, useRenderer, useTerminalDimensions } from "@opentui/react"; import type { ScrollBoxRenderable, KeyEvent } from "@opentui/core"; ``` ## JSX Elements (Lowercase!) ```tsx // CORRECT - OpenTUI intrinsics Hello // WRONG - Not OpenTUI
, , , ``` | Element | Purpose | Key Props | |---------|---------|-----------| | `` | Container/layout | `style`, `id`, `onMouse` | | `` | Text content (strings only!) | `fg`, `bg`, `selectable` | | `` | Scrollable container | `ref`, `focused` | | `` | Hyperlink (OSC8) | `href`, `fg` | | `` | Text input | `focused`, `onInput`, `onSubmit` | | `