Overflow Detection
Detects whether an element's content overflows its container using ResizeObserver. Returns a ref to attach and a reactive boolean — no polling, no manual recalculation.
Installation
dgadd ships in @diffgazer/add on npm: pnpm add -D @diffgazer/add puts it on pnpm exec, and npx @diffgazer/add runs it without the install.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS from the installed package.
Parameters
Returns
Examples
Basic Detection
Notes
Common Use Cases
Conditionally showing tooltips on truncated text, toggling expand/collapse buttons, applying visual indicators when content is clipped.
Requirement
The ref'd element must have constrained dimensions. For horizontal detection, the element needs a width constraint (e.g. truncate, max-w-*, fixed width). For vertical, it needs a height constraint.
Source
Highlighted source loads after this disclosure opens. Browse the source repository.