radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.84k stars 821 forks source link

Enable aligning a DropDownMenu Arrow to trigger #2412

Open CohenBenco opened 1 year ago

CohenBenco commented 1 year ago

Feature request

Overview

At the moment, it seems that DropDownMenu Arrow positioning is always to the center of the trigger. The feature request is to add another "align" or "anchor" option, to allow setting the arrow to the left / right / px from the trigger.

Thank you!

Additional context

example: i want the arrow to be under the avatar (or 15px from left of the trigger)

Screenshot 2023-09-26 at 17 51 03
benoitgrelard commented 8 months ago

We should add an Anchor part like we have in Popover, which would enable you to set it around the avatar for positioning yet have the whole thing be the trigger.

In the meantime, you may be able to achieve this by wrapping just the avatar in the trigger, but position an extra element (with position absolute in a relative wrapper) to cover the whole avatar+text block.