# OpenTUI Core (@opentui/core) The foundational library for building terminal user interfaces. Provides an imperative API with all primitives, giving you maximum control over rendering, state, and behavior. ## Overview OpenTUI Core runs on Bun with native Zig bindings for performance-critical operations: - **Renderer**: Manages terminal output, input events, and the rendering loop - **Renderables**: Hierarchical UI building blocks with Yoga layout - **Constructs**: Declarative wrappers for composing Renderables - **FrameBuffer**: Low-level 2D rendering surface for custom graphics ## When to Use Core Use the core imperative API when: - Building a library or framework on top of OpenTUI - Need maximum control over rendering and state - Want smallest possible bundle size (no React/Solid runtime) - Building performance-critical applications - Integrating with existing imperative codebases ## When NOT to Use Core | Scenario | Use Instead | |----------|-------------| | Familiar with React patterns | `@opentui/react` | | Want fine-grained reactivity | `@opentui/solid` | | Building typical applications | React or Solid reconciler | | Rapid prototyping | React or Solid reconciler | ## Quick Start ### Using create-tui (Recommended) ```bash bunx create-tui@latest -t core my-app cd my-app bun run src/index.ts ``` The CLI creates the `my-app` directory for you - it must **not already exist**. **Agent guidance**: Always use autonomous mode with `-t