aaronshaf / react-toggle

Elegant, accessible toggle component for React. Also a glorified checkbox.
http://aaronshaf.github.io/react-toggle/
MIT License
948 stars 158 forks source link

Enhancement: console.warn when no label is provided #12 #122

Open tgfbikes opened 6 years ago

tgfbikes commented 6 years ago

This is an enhancement (idea from @aaronshaf) that will give a warning in the console if the developer does not provide standard label implementation, such as wrapping react-toggle component in a label, providing a label with a 'for' attribute that matches an id prop for a react-toggle component, etc.

Changes to the react-toggle component:

Added utils: