Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 489
galah92 Avatar asked Nov 17 '17 08:11

galah92


People also ask

How do I change the scrollbar on Webkit?

Scrollbar Selectors For webkit browsers, you can use the following pseudo elements to customize the browser's scrollbar: ::-webkit-scrollbar the scrollbar. ::-webkit-scrollbar-button the buttons on the scrollbar (arrows pointing upwards and downwards). ::-webkit-scrollbar-thumb the draggable scrolling handle.

How do I change inline style in react?

Setting Inline Styles in a React ComponentSpecify the style object inside the constructor as follows. Notice here that the text-align CSS property got camel-cased to textAlign . Pass this styles object to the <H1 /> component, as shown below. Combine multiple style objects using the spread operator.

Can We Use inline CSS in react?

Rule of Thumb. The official React documentation frowns upon the use of inline styling as a primary means of styling projects and recommends the use of the className attribute instead.


1 Answers

This worked in my project '&::-webkit-scrollbar': { width: 0, }

like image 94
Elena Avatar answered Sep 23 '22 20:09

Elena