How to set z-index on a component?

Robert Kovačević picture Robert Kovačević · Nov 27, 2015 · Viewed 55.6k times · Source

Tried using the 'zindex' prop, as suggested here: https://github.com/facebook/react/issues/1456

<Input ref="username" type="text" label="Username" 
placeholder="Enter username" zindex={1} />

Doesn't work. Also tried 'zindex="1"'

Any ideas?

Answer

Blake picture Blake · Mar 30, 2016

you need to assign it using the style={} construct. Try this:

<Input ref="username" type="text" label="Username" placeholder="Enter username" style={{zIndex:1}} />