Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Pretext.js is a pure JavaScript text layout engine — 600× faster than DOM measurement. Zero dependencies, framework-agnostic, MIT-licensed.
Traffic, search & AI signals for pretextjs.dev.
Third-party traffic estimate · Updated Aug 9, 2026
Submit your own product to reach creators and founders looking for the next tool to try.

One web data API for content creators. Pull clean text from any page, monitor competitors, track how your brand appears on ChatGPT and Gemini, and run deep research automatically. Used by newsletters, agencies, and independent creators.

A pact network that helps founders prepare for their Product Hunt by finding support from fellow founders.

AI sales agent that automates LinkedIn outreach to find prospects, send messages, and book meetings.

Free online audio to text converter that turns MP3 and 45+ audio formats into 99-language transcripts with timestamps and speaker labels.

A free browser-based 3D ritual where you break a virtual willow branch and receive an AI-written consequence for your wish.

Weekly startup launch platform where founders showcase new products, get community votes, and grow faster.

Interactive YouTube embeds with polls, quizzes & lead form
Pretext.js is a pure JavaScript/TypeScript text layout engine that measures and positions multiline text entirely through arithmetic — never touching the DOM — achieving 600× faster performance than traditional getBoundingClientRect calls.
Pretext.js is a pure JavaScript/TypeScript text measurement and layout engine created by Cheng Lou (chenglou), a former React core team member now at Midjourney. It takes a string of text and a font specification, measures every word once via Canvas and Intl.Segmenter, then computes line breaks and heights using pure arithmetic — outputting exact pixel heights and line counts without any DOM access. The library runs in any modern browser and is framework-agnostic, weighing approximately 15KB with zero runtime dependencies. It is MIT-licensed and available on npm as @chenglou/pretext.
layout() function performs no getBoundingClientRect calls, no reflow, and no layout thrashing. After preparation, all computation is arithmetic.measureText() API, matching what the browser would actually render.Intl.Segmenter.@types packages needed.prepare() call works for any container width; compute heights for mobile, tablet, desktop from the same handle.Intl.Segmenter.measureText() to get real glyph advance widths from the font engine. Results are cached in a prepared handle.Yes, Pretext.js is MIT-licensed and free for any use — personal, commercial, or open source.
Pretext.js supports 12+ writing systems including CJK, Arabic, Hebrew, Thai, Hindi, Korean, and Latin-based scripts. It uses Unicode segmentation and Intl.Segmenter for correct bidirectional text handling.
Pretext.js is approximately 600× faster. A 1,000-item layout using DOM getBoundingClientRect takes roughly 94 ms (6 dropped frames at 60fps), while Pretext.js completes in about 2 ms — all without forced synchronous reflow.
Yes, Pretext.js is framework-agnostic. It works with React, Vue, Svelte, or vanilla JavaScript. The library provides only prepare() and layout() functions that return plain values, so integration is straightforward.