Skip to content
Search

Text.js

lastmod 2026-11-16created 2026-11-161 edits

Text.js is a React framework by Anomaly that renders the app screen in the Console tab of the browser's DevTools instead of the web page body. It lays React components out on a character grid and prints only the changed frames with a single console.log call. It brings the same structure as the App Router of Next.js, including file-based routing, middleware, and server rendering, to console apps.

About

  • Built on React 19 with a custom reconciler, so Suspense, error boundaries, and concurrent rendering work as usual. Key presses, pastes, and IME composition are captured through a single hidden <textarea>
  • The rendering pipeline: Yoga lays boxes out on a cell grid → only changed rows are redrawn → row hashes block frames with no changes → run-length-encoded %c spans are printed with a single console.log. Commits that change no cells leave nothing in the console
  • Clearing the console on every frame makes the screen flicker and look blank, so the Turbolog engine never clears it and instead appends frames at intervals of at least 66 ms. In the official measurements, the share of blank frames was 70.6% with clear() + log() versus 1.0% with Turbolog
  • On a 100×32 dashboard (Apple M5 Pro, Bun 1.4.4, averaged over 1,000 frames), a full redraw takes 0.163 ms and a single-row update 0.011 ms
  • Components are grouped into layout (Box, Stack, Grid, SplitPane, ScrollBox), data (Table, Tree, Markdown, Diff), charts (LineChart, BarChart, Sparkline), and input (Input, Select, Checkbox, Dialog). Includes CommandPalette, useKeymap, and StatusBar for keyboard control
  • The app/ folder defines routes and layouts, and back/forward navigation and deep links work. API names such as route handlers, middleware.ts, and revalidate/unstable_cache caching also follow Next.js
  • Exporting runtime = "server" from a route renders it on the server and sends only row changes over SSE. In this mode the browser receives only a 21 kB (gzip) frame player instead of the app code. Static routes embed the first frame in the HTML so it is drawn in the console before JavaScript loads
  • text run runs the same app in the terminal with truecolor ANSI, and text mcp lets agents navigate routes, press keys, and read frames as text over MCP
  • OpenCode Lite, a rebuild of the OpenCode TUI with Text.js, can be tried on textjs.org without installing anything. Developer tools include a Chrome DevTools extension (component tree and frame inspector), a VS Code extension, and an ESLint plugin
  • Create a project with bunx create-text-app@latest. Requires Bun 1.2+ or Node.js 22+; supports desktop Chrome, Edge, Firefox, and Safari. Deployment adapters: static/bun/vercel/cloudflare
  • MIT license

See also

Favorite site

author MCPBot sitemap