Repository navigation
[preview card] Support detached triggers - #3566
Merged
Merged
Conversation
Bundle size report
Check out the code infra dashboard for more information about this PR. |
commit: |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
michaldudak
force-pushed
the
preview-card-store
branch
from
December 19, 2025 11:46
966255b to
31a4cd3
Compare
atomiks
reviewed
Jan 13, 2026
atomiks
reviewed
Jan 13, 2026
michaldudak
force-pushed
the
preview-card-store
branch
from
January 13, 2026 11:55
0c69b8d to
dd373e2
Compare
Member
Author
|
@atomiks I addressed both your remarks. |
michaldudak
commented
Jan 13, 2026
Member
Author
There was a problem hiding this comment.
This is a drive-by change
atomiks
reviewed
Jan 14, 2026
Comment on lines
+213
to
+215
| // If there's just one trigger, we can skip the auto-resize logic as | ||
| // the preview card will always be anchored to the same position. | ||
| const autoresizeEnabled = useStableCallback(() => store.context.triggerElements.size > 1); |
Contributor
There was a problem hiding this comment.
This isn't used in PopoverViewport/TooltipViewport
atomiks
reviewed
Jan 14, 2026
Comment on lines
+107
to
+110
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| const store = useRefWithInit(() => { | ||
| return externalStore ?? new PreviewCardStore<Payload>(initialState); | ||
| }).current; |
Contributor
There was a problem hiding this comment.
Move externalStore out of useRefWithInit for hot reloading: 3575dfc
LukasTy
approved these changes
Jan 14, 2026
LukasTy
left a comment
Member
There was a problem hiding this comment.
Awesome work. 👏 🎉
Looks great to me overall, just small nitpicks.
Contributor
|
In "Controlled, detached triggers", when using a keyboard to focus links, if you press Esc and navigate to the next link, it doesn't open. |
atomiks
approved these changes
Jan 14, 2026
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.
Implemented detached / multiple trigger support in PreviewCard, similarly to #2336
It is now possible to define triggers outside of PreviewCard.Root using the
handleprop. Multiple triggers per card with a dynamic payload are also implemented.Playground: https://deploy-preview-3566--base-ui.netlify.app/experiments/preview-card/triggers
Docs: https://deploy-preview-3566--base-ui.netlify.app/react/components/preview-card#detached-triggers