{"id":"pretext","name":"Pretext","url":"https://wunderlust.xyz/r/pretext","category":"components","category_label":"UI components","tags":["free","open-source","typography"],"short":"JavaScript and TypeScript library for measuring and laying out text","what":"It measures paragraphs without querying DOM layout and can render lines in DOM, Canvas, or SVG. Preparation caches measurements for layout calculations.","uses":"For chat developers who need to calculate message height before rendering.","benefits":["Paragraph measurement without DOM layout","Manual line layout"],"links":{"official":"https://github.com/chenglou/pretext"},"image":"https://wunderlust.xyz/media/pretext-poster.jpg","video":"https://wunderlust.xyz/media/pretext.webm","share_image":"https://wunderlust.xyz/og/r/pretext.jpg","similar":["prompt-kit","3dicons","motion-primitives","colour-contrast-checker","daisyui","react-bits"],"added_on":"2026-11-22","steal":"Prepare text measurements once, then recalculate lines when the width changes.","patterns":[],"why":"Reusing prepared measurements lets layout run again without remeasuring the same text and font.","avoid":"Prepare again when text, font, or options change to avoid using stale measurements.","pt":{"name":"Pretext","short":"Biblioteca JavaScript e TypeScript para medir e distribuir texto","steal":"Prepare as medidas do texto uma vez e recalcule as linhas quando a largura mudar.","what":"Mede parágrafos sem consultar o layout do DOM e permite desenhar linhas em DOM, Canvas ou SVG. A preparação guarda medidas para reutilizá-las no cálculo de layout.","uses":"Para desenvolvedores de chats que precisam calcular a altura de mensagens antes de renderizá-las.","benefits":["Medição de parágrafos sem layout do DOM","Distribuição manual de linhas"],"why":"Reutilizar medidas preparadas permite recalcular a distribuição sem repetir a medição do mesmo texto e fonte.","avoid":"Refaça a preparação quando o texto, a fonte ou as opções mudarem para evitar medidas antigas.","intents":["medir texto com várias linhas","calcular altura de mensagens"]},"kind":"library","sector":[],"tone":[],"intents":["measure multiline text","calculate chat message height","layout text without dom","wrap canvas text"],"schema_version":1}
