feat: forward optional per-item triggerProps onto Tabs triggers#116
Merged
Conversation
There was a problem hiding this comment.
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
triggerPropsto eachTabsitem and spread it onto the correspondingTabsTrigger, mergingclassNamesafely. - Document
triggerPropsusage and update the TabItem props table in the demo MDX docs. - Bump
@eqtylab/equalitypackage version to2.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.
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
Adds an optional
triggerPropsfield to eachTabsitem, forwarded onto that item'sTabsTrigger. 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— addedtriggerProps?: Omit<ComponentPropsWithoutRef<typeof TabsTrigger>, "value">to the item shape and spread it onto each trigger.value(selection) and internal styling can't be overridden.classNameis merged viacn, not clobbered — consumers can add classes without losing the internal ones.Trigger, which composes them with its own viacomposeEventHandlers, so tab activation and keyboard navigation are unchanged.data-tourattribute — it was the last reference in the repo, from the retired app tour. If needed again, it now flows throughtriggerPropslike 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
triggerPropsis optional; existing callers are unaffected. Ship as a minor.tsc --noEmitandeslint(both clean).Testing
No test runner exists in this repo yet, so no automated test was added. Manual coverage to verify: forwarded
onPointerEnter/onFocusfire on the correct trigger, forwardedonClickstill activates the tab, a customclassNameis merged with the internal one, and arrow-key navigation still works.