React-popper: z-index?

Created on 2 May 2017  路  2Comments  路  Source: popperjs/react-popper

My poppers are often showing up under other elements on the page. I'm trying to figure out a way to add a z-index to the popper, but figured it was worth asking here in case others have already solved this issue

Most helpful comment

@chrisdrackett this was the exact reason for making everything compose-able :) you can add an inline style, classname or whatever you want.

I take an approach like this for any personal settings I want for components:

const MyPopper = ({ style, ...props }) => (
  <Popper style={{ zIndex: 100, ...style }} {...props}/>
)

All 2 comments

z-index is a sensitive problem and must be handled properly case by case.

That's why Popper.js doesn't set any z-index by default.

You should really end up with the best solution for you and manually set them I think.

@chrisdrackett this was the exact reason for making everything compose-able :) you can add an inline style, classname or whatever you want.

I take an approach like this for any personal settings I want for components:

const MyPopper = ({ style, ...props }) => (
  <Popper style={{ zIndex: 100, ...style }} {...props}/>
)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bgando picture bgando  路  3Comments

souporserious picture souporserious  路  5Comments

gormonn picture gormonn  路  4Comments

linusthe3rd picture linusthe3rd  路  4Comments

websitesca picture websitesca  路  5Comments