Floating Indicator
Measures the active child inside a container and returns a container-relative rectangle for drawing a floating indicator under or around it.
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
Notes
Measurement
The rectangle is measured with getBoundingClientRect relative to the container. ResizeObserver and MutationObserver keep it current when layout or children change.
Matching Contract
Items must expose data-value matching activeValue. The hook scans the container's [data-value] descendants and compares each attribute to activeValue by exact string equality, so any value is supported without escaping.
Source
Highlighted source loads after this disclosure opens. Browse the source repository.