Skip to content

feat: forward optional per-item triggerProps onto Tabs triggers#116

Merged
tmccoy14 merged 1 commit into
mainfrom
feat/tabs-trigger-props
Jul 15, 2026
Merged

feat: forward optional per-item triggerProps onto Tabs triggers#116
tmccoy14 merged 1 commit into
mainfrom
feat/tabs-trigger-props

Conversation

@tmccoy14

@tmccoy14 tmccoy14 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional triggerProps field to each Tabs item, forwarded onto that item's TabsTrigger. This lets consumers attach event handlers or attributes to an individual tab — e.g. per-tab hover/focus prefetching (warming a destination's data when the user shows intent toward a specific tab). Previously the only workaround was wrapping the whole tab strip, which can't distinguish which tab is being pointed at.

Changes

  • tabs.tsx — added triggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, "value"> to the item shape and spread it onto each trigger.
    • Spread before the library-owned props, so value (selection) and internal styling can't be overridden.
    • className is merged via cn, not clobbered — consumers can add classes without losing the internal ones.
    • Event handlers pass through to Radix's Trigger, which composes them with its own via composeEventHandlers, so tab activation and keyboard navigation are unchanged.
  • Removed the leftover data-tour attribute — it was the last reference in the repo, from the retired app tour. If needed again, it now flows through triggerProps like any other attribute.
  • tabs.mdx — documented the new field in the TabItem table and added a "Forwarding trigger props" section with a prefetch example.

Notes

  • Non-breakingtriggerProps is optional; existing callers are unaffected. Ship as a minor.
  • Verified with tsc --noEmit and eslint (both clean).

Testing

No test runner exists in this repo yet, so no automated test was added. Manual coverage to verify: forwarded onPointerEnter/onFocus fire on the correct trigger, forwarded onClick still activates the tab, a custom className is merged with the internal one, and arrow-key navigation still works.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Tabs component API to allow forwarding per-item props onto individual tab triggers (e.g., for per-tab prefetch handlers), updates the Tabs documentation to describe the new capability, and bumps the UI package version.

Changes:

  • Add triggerProps to each Tabs item and spread it onto the corresponding TabsTrigger, merging className safely.
  • Document triggerProps usage and update the TabItem props table in the demo MDX docs.
  • Bump @eqtylab/equality package version to 2.3.2.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/ui/src/components/tabs/tabs.tsx Adds optional per-item triggerProps forwarded to TabsTrigger and merges item className with internal styling.
packages/ui/package.json Bumps UI package version to 2.3.2.
packages/demo/src/content/components/tabs.mdx Adds docs and examples for triggerProps and updates the TabItem structure table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tmccoy14
tmccoy14 merged commit fc985e3 into main Jul 15, 2026
2 checks passed
@tmccoy14
tmccoy14 deleted the feat/tabs-trigger-props branch July 15, 2026 15:41
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.

2 participants