Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Fire events directly on Switch checked action as well as on unchecked action. #3665

Open
sinharaksh1t opened this issue Jul 17, 2019 · 0 comments

Comments

@sinharaksh1t
Copy link

Environment

  • Package version(s): 3.17.0
  • Browser and OS versions: Google Chrome Version 75.0.3770.100 and Windows 10

Question

Is it possible to fire custom onClick handlers on checked as well as on unchecked states for the <Switch /> component?
For eg,

<Switch
  onChecked={() => this.checkedHandler()}
  label="Public"
  onUnchecked={() => this.uncheckedHandler()}
/>

I am not sure if others have felt a similar use case for firing events directly while checking/unchecking the <Switch /> component instead of setting local state and then taking action according to the new state. I'm not saying that the default behavior should be scrapped, but is there scope for this kinda behavior that the above example portrays?

I would love to hear from the Blueprint team as well as the community. ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant