Pretext Does What CSS Can't — Measuring Text Before the DOM Even Exists
Pretext is a new JS/TS library from Cheng Lou (React core, react-motion, Midjourney) that calculates multiline text height without DOM reflow. It splits work into a one-time prepare() pass via off-screen canvas, then a pure-arithmetic layout() hot path that runs in ~0.09ms. The result: accurate pre-render height prediction for virtualized lists, chat UIs, and canvas renderers — plus layout primitives CSS literally doesn't have, like finding the minimum width for a block of text at a fixed line count. Solid i18n, rigorous accuracy testing, 7k+ GitHub stars in days. Still early: no SSR, system-ui is broken on macOS, and the 500x benchmark is the author's own caveat.
Find Your Interest
- Advice Line with Tara Bosch of SmartSweets
- Advice Line with Chris Riccobono of UNTUCKit
- Advice Line with Sarah LaFleur of M.M. LaFleur
- Advice Line with Chieh Huang of Boxed
- Advice Line with Lara Merriken of LÄRABAR (October 2024)
- Advice Line with Lara Merriken of LÄRABAR
- details/summary inconsistencies
- Classic Agatha Christie Detective Duo Is Getting Another Shot on TV
- Patrick Ewing Made History As The First NBA Player To Launch His Own Shoe Brand In 1989 After Walking Away From Adidas — Here’s How The Business Move Is Playing Out Today
- fix(discord): show busy notices on session initialization conflicts (…





