Zero-CLS accordion powered by predictive text measurement. Open and close without any layout shift.
AccordionItem mounts, useAccordionHeight extracts text content from children.@chenglou/pretext's prepare() and layout() functions. These use an offscreen canvas to predict how text will wrap — no DOM measurement needed.height: 0 to height: {predicted}px. Since the height is known before rendering, there is zero layout shift.auto so the content can adapt to dynamic changes.scrollHeight measurement is used and cached.