

Pretext
Pretext is a tiny (15KB gzipped) zero-dependency TypeScript library that handles text layout, measurement, and rendering entirely outside the DOM. Created by Cheng Lou (React core team, Reason, Midjourney), it delivers up to 500x faster performance than traditional DOM...
Cost / License
- Free
- Open Source (MIT)
Platforms
- Typescript
- JavaScript
- npm

Pretext
Features
Pretext News & Activities
Recent activities
Pretext information
What is Pretext?
Pretext is a tiny (15KB gzipped) zero-dependency TypeScript library that handles text layout, measurement, and rendering entirely outside the DOM. Created by Cheng Lou (React core team, Reason, Midjourney), it delivers up to 500x faster performance than traditional DOM measurement. The library works across browsers, Node.js, and native platforms using a single portable API. Key features include multi-line wrapping with word-break control, built-in rich text and inline styling, automatic truncation with ellipsis, hit-testing for click/caret positioning, and full BiDi and Unicode support. With 29,500+ GitHub stars, Pretext powers demanding use cases like real-time editors, canvas-based UIs, and design tools where DOM text handling creates bottlenecks.
