formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
120 stars 4 forks source link

[Feature] PopoverContent offsetX, offsetY #306

Closed mareksed closed 1 month ago

mareksed commented 3 months ago

Is your feature request related to a problem? Please describe. I want more control to position popover content,

You have a toolbar that composes various popover buttons in row. Most left and right buttons should position the popover bottom-start and bottom-end. Currently I am not able to define paddingInline because it won't be taken into account on trigger and there will be a gap.

Describe the solution you'd like Allowing to tweak position offsetX and offsetY on popovers would allow me to enter negative size unit. Sort of similiar thing we do with bleed on View component.

Describe alternatives you've considered I can just not use paddingInline and set paddingStart and paddingEnd on first and last buttons., but it makes composition bit more tricky. For example if last item is displayed conditionally, it is not just some simple if-else I need to adjust also paddingEnd of it.

Additional context https://codesandbox.io/p/sandbox/reshaped-toolbar-zvqqmw

https://floating-ui.com/docs/offset

blvdmitry commented 1 month ago

Since positions can change dynamically, it shouldn't be tied to x or y in the name. There is already a contentGap property for controlling the gap between the trigger and the content (main axis), so I'm thinking about adding contentShift for the secondary axis.

wdyt about this naming? I was also thinking about using something like secondary in its name but for secondary axis it isn't actually a gap

<Popover contentGap={2} contentShift={-4}>
mareksed commented 1 month ago

Good point about axis being dynamic, contentShift sounds really good it matches contentGap.

blvdmitry commented 1 month ago

Ready for the next patch, shipping together with a few other requests soon 🚀 Made it available for Popover, DropdownMenu and Tooltip