Skip to content

feat: Introduce Popover.Context and onOpen handler#8546

Open
Newbie012 wants to merge 2 commits intomantinedev:masterfrom
Newbie012:feat-popover-context
Open

feat: Introduce Popover.Context and onOpen handler#8546
Newbie012 wants to merge 2 commits intomantinedev:masterfrom
Newbie012:feat-popover-context

Conversation

@Newbie012
Copy link
Contributor

@Newbie012 Newbie012 commented Dec 16, 2025

Adds Popover.Context, a render-prop component providing access to the popover context, including new onOpen. This allows custom state control while still using built-in components. I also Included documentation and a test case for hover behavior.

Example:

<Popover>
  <Popover.Target>
    <Popover.Context>
      {({ onOpen, onClose }) => (
        <button type="button" onMouseEnter={onOpen} onMouseLeave={onClose}>
          test-target
        </button>
      )}
    </Popover.Context>
  </Popover.Target>

  <Popover.Dropdown>
    <div>test-dropdown</div>
  </Popover.Dropdown>
</Popover>

Adds `Popover.Context`, a render-prop component providing access to the popover context, including new `onOpen`. This allows custom state control while still using built-in components. Includes documentation and a test case for hover behavior.
@Newbie012 Newbie012 changed the title FEAT feat: Introduce Popover.Context and onOpen handler feat: Introduce Popover.Context and onOpen handler Dec 16, 2025
Removed section on `onOpen` and `onClose` callbacks from popover documentation.
@shwu-jt
Copy link

shwu-jt commented Feb 11, 2026

I think we can make <Popover> to take ReactNode | (args: {onOpen, onClose}) => ReactNode instead so we don't need another layer of <Popover.Context>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants