feat: headless useOverflowList hook + popover-based shadcn registry (v0.4.0)#16
Merged
Merged
Conversation
Adds a headless `useOverflowList` hook so consumers can build custom layouts (pinned siblings, filter chip bars, etc.) reusing the same three-phase measurement engine that powers the JSX `OverflowList` primitive. The primitive itself is refactored to consume the hook (278 → 173 lines) with zero changes to its public surface. Shadcn registries (radix-vega, base-vega) switch from DropdownMenu to Popover and gain better abstractions: - discriminated union supporting items+renderItem OR children - `renderOverflowContent` escape hatch (replace entire popover body) - `popoverContentClassName` for per-instance overrides - minimal trigger styling (no Button dependency; lean `+N` label) Demo gains a Headless Hook example (positioned second) showcasing the pinned Filters/Clear pattern enabled by the hook. Bumps to 0.4.0 — fully backward compatible (additive only). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
✅ Deploy Preview for react-responsive-overflow-list ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…to DOM
These wrapper-only props weren't destructured before forwarding `{...props}`
to the primitive, so they reached the host element and triggered React's
"unknown prop on DOM" warning when consumers passed either of them.
Caught by a fresh-app sanity check via `shadcn add`.
Also includes linter-applied formatting touch-ups on adjacent files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useOverflowList— the measurement state machine is extracted from<OverflowList />into a reusable hook. The component now consumes it (278 → 173 lines, zero public-API change). Enables custom layouts like a filter chip bar with pinned left/right elements that the JSX wrapper can't express. Battle-tested in a private codebase.items + renderItemorchildren)renderOverflowContent?: (hidden) => ReactNode— full override of popover bodypopoverContentClassName?: string— per-instance content stylingButtondependency, lean+Nlabel)renderItemwhenrenderOverflowItemor children-mode is usedHeadlessHookExample(positioned second, with sidebar entry) showcasing pinned Filters/Clear pattern.Bumps to 0.4.0 — purely additive, fully backward compatible.
Test plan
pnpm type-checkpassespnpm buildproducesdist/with newuseOverflowList,OverflowListPhase,UseOverflowListOptions,UseOverflowListReturnexports inindex.d.tspnpm build:registrysucceeds for both radix-vega and base-vega/docs/shadcn: both Radix UI and Base UI variants render lean+Ntrigger; popover opens and shows hidden itemsnpx shadcn@latest addon a fresh app and verify it pulls in the rightpopoverregistry dep🤖 Generated with Claude Code