Skip to content

React-aria-components TooltipTrigger with custom button #5119

Answered by LFDanLu
hrigner asked this question in Q&A
Discussion options

You must be logged in to vote

The RAC (react-aria-components) TooltipTrigger sends the focus/press props that the trigger needs via a context setup by FocusableProvider +

<FocusableContext.Provider value={context}>
. Our RAC Button's call of useButton accesses this context via a useFocusable call so if you were to use your own custom button element you'd have to call useButton as well. For non-button elements you'd call useFocusable and usePress.

I'd be careful when accepting any element as a trigger since you'll want to make sure its an element that supports focus/press interactions. Is there a particular reason you can…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by hrigner
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants