Skip to content

[popover] detached trigger without the Popover.Trigger element #3577

@MonstraG

Description

@MonstraG

I used to work with MUI, but recently stared with shadcn/Radix UI, and have found the pattern of <Popover.Trigger/> quite lacking.

I usually would have a table with 20-100 rows, each with a button, that opens the same menu with actions like edit | delete | etc.

When implementing this in Radix UI I was disappointed to find that I need to put <Dropdown/> in each row, around a trigger, for it to function. That felt like a huge performance performance fail, as I would have 100 copies of the same dropdown with different context.

In MUI I would place one <Menu/>, and just supply anchorEl trough home-written equivalent of Base UI's popover.createHandle.

I just accepted that as a fact of life before, but Base UI has suddenly released, and I am glad to see that as opposed to Radix UI, Base UI supports detached triggers, so I could have 100 triggers and 1 <Dropdown />, which is great!

Today, I'm working on a SVG-based room layout editor, and would like to be able to right-click the nodes to bring up custom context menu with actions:

Image

So, left-click should drag, and right click should open the context menu. In this case, putting <Popover.Trigger/> around the <circle/> just doesn't seem to work.

How do I just pass the element ref to the popover like I used to do in MUI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: popoverChanges related to the popover component.linked in docsThe issue is linked in the docs, so completely skew the upvotes.support: questionCommunity support but can be turned into an improvement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions