Implementing a Popover with a custom button #1162
-
Hi there, I need to create a popover with a custom button (got a 👍 in a UX review) to open it. Unfortunately it looks like as well as using the Box primitive for the Button, I'll need to use Non Modal Dialog Primitive since the PopoverButton hardcodes to a Button and the PopoverContext isn't exported. I also tried importing it directly but that also didn't work e.g. So my approach would be to essentially copy the Paste implementation for Popover but provide a custom Button (and possibly change the popover width). I just wanted to double check I hadn't missed anything, as I really would prefer not to go down the Non Modal Dialog Primitive if at all possible. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hey @synnottd - can you share the design so we can see what this custom button looks like? I'm wondering if the Reset Button could work for you instead of composing a custom button using Box. This should allow you to use Popover instead of the Non-modal Dialog Primitive. |
Beta Was this translation helpful? Give feedback.
-
Hi @serifluous and @katieporter , For some UX context, The regional team has gone through a series of reviews in DSYS office hours, crits, and UX Clinics etc for this component across the platform. We have a need to create cohesion quickly to support many teams that will need to adopt and develop it. We got sign off on this direction at DSYS office hours. The challenge for development is that we need to tweak the button and popover component. To create alignment, @synnottd has taking on the responsibility of creating this for Regional. This component will be extended and be used by Phone numbers, Console, and Identity for the Regional Pilot and more teams for GA. I was hoping to use a paste component but we do not see one that fits to this badge/status need that we have. Is this something that DSYS can help all of these teams with by creating a new badge with popover for regional? If not, please advise how @synnottd can best move forward with the tools that he has to contribute this component. My goal is to ensure that the experience is cohesive and to not duplicate effort. This Regional Information Affordance Badge will be implemented by more teams soon and I am hoping we streamline its implementation so that we can make edits quickly. Please advise how to tweak the popover component to fit this need. Attached is a spec for reference. Please let me know if you have any questions or concerns. |
Beta Was this translation helpful? Give feedback.
-
This is what I was able to come up with using the reset button. https://166a9bfdda9a--twilio-console-storybook.netlify.app/?path=/story/utilities-regionalpopover--default
We can solve the last three using the Non Modal Dialog Primitive. I don’t see a way of solving the radius problem with a design token, it seems like the largest radius is 8px and this would need 12px. |
Beta Was this translation helpful? Give feedback.
Hey @synnottd - can you share the design so we can see what this custom button looks like? I'm wondering if the Reset Button could work for you instead of composing a custom button using Box. This should allow you to use Popover instead of the Non-modal Dialog Primitive.