Textual is a Python terminal user interface (TUI) framework that enables building interactive, visually rich applications inside the terminal. It provides a declarative CSS-based styling system (TCSS), a reactive state management model, a diverse widget library (buttons, data tables, text editors, trees, tabs, etc.), and an asynchronous event-driven architecture. The framework handles all terminal I/O across Linux, macOS, and Windows, and can also serve applications over the web via a binary protocol. Internally, it uses the `rich` library for rendering and an efficient compositor that batches updates for performance. The primary entry point is the `App` class in `src/textual/app.py`, from which users subclass and compose widgets via `compose()` methods. Styling can be embedded as `DEFAULT_CSS` or loaded from external `.tcss` files. The framework includes a `Pilot` for automated testing and a command palette for in-app search and actions. Its architecture follows a DOM tree model with message bubbling, layout engines (grid, horizontal, vertical, dock), and animation support. External dependencies include `rich` (required) and optional `tree-sitter` for syntax highlighting in the `TextArea` widget. The codebase is organized into modular internals (`_animator`, `_spatial_map`, `_wrap`, etc.) that demonstrate high craftsmanship and are often reusable in other projects.