jasonkuhrt / react-popover

A smart popover component for React
600 stars 253 forks source link

feat: Option to append Popover to a specific DOM element #134

Closed cbmono closed 6 years ago

cbmono commented 7 years ago

Attempt to fix this issue: Append to node other than body

Usage

Pass appendTarget as a property and specify the query selector where you want to append the Popover. In case of classes (ie. "#app > .foo"), it will append the Popover to the first found child.

    return (
      <Popover
        appendTarget="#my-div-container"    // <-----
        isOpen={isOpen}
        body="Boo!"
      >
        // ...
      </Popover>
    )

image

jasonkuhrt commented 6 years ago

@cbmono Thanks for putting this together! Looks good to me. Lets get this out in the next release.