galah92
galah92

Reputation: 3991

Customize `::-webkit-scrollbar` inline with React

How can I apply the ::-webkit-scrollbar pseudo elements to a component using inline styling in React?

Upvotes: 23

Views: 31103

Answers (3)

satyajit rout
satyajit rout

Reputation: 1651

You can't write pseudo selector inline, you need to add it in css. Refer this link

Upvotes: 15

Elena
Elena

Reputation: 161

This worked in my project '&::WebkitScrollbar': { width: 0, }

Upvotes: 16

Francesco Orsi
Francesco Orsi

Reputation: 2089

React suggests this

<div style={{ '&::WebkitScrollbar': { width: 0, height: 0 } }}></div>

Upvotes: 3

Related Questions