markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 100 forks source link

Addition of an extra state so that it behaves as a tri state switch #52

Closed vjr12 closed 4 years ago

vjr12 commented 5 years ago

Want to implement something like a switch that has three states, "ENABLED,PENDING,DISABLED" . Is it possible that something like this can be implemented

Something like this? Screenshot from 2019-08-13 17-14-01

Screenshot from 2019-08-13 17-16-48

Screenshot from 2019-08-13 17-16-35

djD-REK commented 5 years ago

Yes, that type of Switch is super possible, though please tell me if you figure out how to do it in react-switch!

I created a 3-way drag-and-drop switch here that starts in the middle position but can be swiped left or right for my language learning game I'm developing:

https://codesandbox.io/s/learn-penguin-app-prototype-github-master-qqtem

Best regards, Derek

Derek R. Austin, PT, DPT, MS, BCTMB, CSCS

Join me on LinkedIn: https://www.linkedin.com/in/Derek-Austin

El mar., 13 ago. 2019 a las 13:17, velsonjr (notifications@github.com) escribió:

Want to implement something like a switch that has three states, "ENABLED,PENDING,DISABLED" . Is it possible that something like this can be implemented

Something like this? [image: Screenshot from 2019-08-13 17-14-01] https://user-images.githubusercontent.com/42905121/62939069-037e8480-bdee-11e9-8ca4-28d3df4ec6d7.png

[image: Screenshot from 2019-08-13 17-16-48] https://user-images.githubusercontent.com/42905121/62939143-332d8c80-bdee-11e9-84a7-ea3594eb23e5.png

[image: Screenshot from 2019-08-13 17-16-35] https://user-images.githubusercontent.com/42905121/62939174-404a7b80-bdee-11e9-8cbf-a724020b4571.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/markusenglund/react-switch/issues/52?email_source=notifications&email_token=AMV42QRI642JWQMUDWHV5UTQELUCBA5CNFSM4ILM6JZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFALM6A, or mute the thread https://github.com/notifications/unsubscribe-auth/AMV42QS4EQ6TAK6P6ZRDVLDQELUCBANCNFSM4ILM6JZQ .

vjr12 commented 5 years ago

@djD-REK Waiitng for the creator's comments. It would be great if you could find one:). Have searched a lot, but could not find one that actually matches the requirements:(

markusenglund commented 5 years ago

It's not supported to do currently. I'm open to the idea but it seems like a big headache to implement and support since react-switch wasn't built with this use case in mind. It would probably have to involve adding a lot of new props that would only be used for this.

duhaime commented 3 years ago

@vjr12 could this be reopened? This would be a great addition to the library. At the very least the feature request should stay open so other developers could contribute this generalization of the ui...