gfazioli / react-switch-button

React Switch Button control
http://gfazioli.github.io/react-switch-button/
MIT License
86 stars 36 forks source link

don't change class/color when toggled #22

Closed derekyau closed 7 years ago

derekyau commented 7 years ago

awesome component!

i'm using the switch button in the sense of switching between two options rather than 'on/off', is there an easy way I can disable it from changing color to the 'off-state' and just keep it 'on' the whole time?

gfazioli commented 7 years ago

Hi @derekyau ,

yes, you can do that by adding this styles in your page:

<style>
    .rsbc-switch-button.rsbc-switch-button-flat-round input[type="checkbox"] + label:after,
    .rsbc-switch-button.rsbc-switch-button-flat-round:hover input[type="checkbox"]:checked + label,
    .rsbc-switch-button.rsbc-switch-button-flat-round input[type="checkbox"] + label
    {
      background-color: #579fcb !important;
    }
</style>

the above styles will override the default scheme colour.

derekyau commented 7 years ago

this is great @gfazioli ! thanks

gfazioli commented 7 years ago

@derekyau please, have a look at the new props mode in v2.2.0

image

derekyau commented 7 years ago

thanks @gfazioli - I've upgraded, and its great. Just in time too, since I needed two switches on my page (one that behaved as normal, and one as 'mode=select'.

timely, thanks.

gfazioli commented 7 years ago

@derekyau you are welcome