Skip to content

feat: headless useOverflowList hook + popover-based shadcn registry (v0.4.0)#16

Merged
Eliav2 merged 4 commits into
mainfrom
feat/headless-hook-and-popover-shadcn
May 25, 2026
Merged

feat: headless useOverflowList hook + popover-based shadcn registry (v0.4.0)#16
Eliav2 merged 4 commits into
mainfrom
feat/headless-hook-and-popover-shadcn

Conversation

@Eliav2
Copy link
Copy Markdown
Owner

@Eliav2 Eliav2 commented May 24, 2026

Summary

  • New headless hook 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.
  • Shadcn registry refactor (radix-vega + base-vega) — switches from DropdownMenu to Popover and adds genuinely-useful abstractions:
    • discriminated union (items + renderItem or children)
    • renderOverflowContent?: (hidden) => ReactNode — full override of popover body
    • popoverContentClassName?: string — per-instance content styling
    • minimal trigger (no Button dependency, lean +N label)
    • optional renderItem when renderOverflowItem or children-mode is used
  • Docs + demo — README gains a "Headless hook" section; demo gains a HeadlessHookExample (positioned second, with sidebar entry) showcasing pinned Filters/Clear pattern.

Bumps to 0.4.0 — purely additive, fully backward compatible.

Test plan

  • pnpm type-check passes
  • pnpm build produces dist/ with new useOverflowList, OverflowListPhase, UseOverflowListOptions, UseOverflowListReturn exports in index.d.ts
  • pnpm build:registry succeeds for both radix-vega and base-vega
  • Demo dev server: Headless Hook example renders correctly with pinned Filters left + Clear right, only the middle chip row overflows responsively
  • Demo /docs/shadcn: both Radix UI and Base UI variants render lean +N trigger; popover opens and shows hidden items
  • All pre-existing examples still behave identically (component refactor is structural only)
  • Reviewer sanity-check: install via npx shadcn@latest add on a fresh app and verify it pulls in the right popover registry dep

🤖 Generated with Claude Code

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>
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented May 24, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@netlify
Copy link
Copy Markdown

netlify Bot commented May 24, 2026

Deploy Preview for react-responsive-overflow-list ready!

Name Link
🔨 Latest commit 99f9fd2
🔍 Latest deploy log https://app.netlify.com/projects/react-responsive-overflow-list/deploys/6a1497fd601622000842e29b
😎 Deploy Preview https://deploy-preview-16--react-responsive-overflow-list.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Eliav2 and others added 3 commits May 25, 2026 21:39
…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>
@Eliav2
Copy link
Copy Markdown
Owner Author

Eliav2 commented May 25, 2026

Code review

No 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 👎.

@Eliav2 Eliav2 merged commit 5f97b5d into main May 25, 2026
4 checks passed
@Eliav2 Eliav2 deleted the feat/headless-hook-and-popover-shadcn branch May 25, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant