react-switch icon indicating copy to clipboard operation
react-switch copied to clipboard

Impossible customization by CSS

Open MatsMaker opened this issue 5 years ago • 8 comments

Nice job. But needs to add customization styles from file styles. And not use only inline styles in the component props.

MatsMaker avatar Feb 06 '20 00:02 MatsMaker

True... CSS customization is impossible... I'm facing the same issue

CesarGonzAndres avatar Jul 03 '20 20:07 CesarGonzAndres

Is there any update on this? I can only overwrite the default styles with the "!important" rule.

BorisL91 avatar Jul 16 '20 09:07 BorisL91

I have same question, recently i started using this library, i would like to know how can we use separate css file for this component instead of inline css

sabahath786 avatar Aug 24 '20 13:08 sabahath786

css styles is a must :(

santisiri avatar Sep 16 '20 15:09 santisiri

Due to how the component is built, CSS can't be used for some properties. offColor, onColor, offHandleColor and onHandleColor have to be passed to the component as props so it can calculate intermediate color values. handleDiameter, height and width also has to be passed in as props since they are needed for the handle positioning calculation.

Overriding these values with !important can be used in some very specific cases but is generally not recommended right now.

Feel free to share specifics of what you want to do or ideas of how the component could be changed to better fit your needs.

markusenglund avatar Dec 12 '20 20:12 markusenglund

I am curious how we can customize the handle itself besides onHandleColor? I would like to be able to add a border to the handle

Jordan1022 avatar Nov 22 '21 22:11 Jordan1022

@Jordan1022 , this is a separate issue, no?

artemis-prime avatar May 20 '23 16:05 artemis-prime

@artemis-prime yes you're right

Jordan1022 avatar May 24 '23 18:05 Jordan1022