Force Radix dropdown sub menu to open on left

1k Views Asked by At

We have a Radix nested dropdown and we want the submenus to always open to the left. The default for Radix seems to be to the right. I have tried, amongst other things, [data-side] but haven't gotten it to work. Aside from brute-forcing this in Javascript, is there a Radix based way to do this? I also need this to be accessible, and so the left arrow key must open the menu as well.

Here's an ugly but basic example of a Radix nested dropdown: https://codesandbox.io/p/sandbox/musing-feistel-3jx4vk?file=%2FApp.jsx%3A64%2C16

1

There are 1 best solutions below

0
Teta On

You are using align='start' in your example, if you just remove it, it will align in the center as default

https://www.radix-ui.com/primitives/docs/components/dropdown-menu#dropdown-menu