arnthor3 / react-bootstrap-toggle

Bootstrap-toggle without the JQuery dependencies
Other
54 stars 16 forks source link

Include more example in a documentation page #20

Closed titse closed 6 years ago

titse commented 6 years ago

Please include more example for this React component. For example, I would like to know how would I style my toggle button and add onClick handler function.

arnthor3 commented 6 years ago

What exactly do you want to style? There is a small example for the onClick in the readme. I will try to commit a couple of examples asap.

titse commented 6 years ago
  1. I would like to style the button with example of being able to pass additional props such as class name or id. I would like to be able to change the color of the button and the slider. I would like to see an example if we can add icons to the button in addition to text.
  2. I would like to know how the onClick button works with a example such as triggering an event. It could be simple as toggle a message "Hello React World!" into the HTML page. I am using event and state to trigger a change in state object to set value to "Complete".

If I come up with any more use cases, I will post here.

arnthor3 commented 6 years ago

I added a folder, "examples", I threw a couple of comments there. Regarding the styles, the component adds a prefix to the classnames you pass in the offstyle and the onstyle props with "btn". So if you would create a custom class 'off_style' you would need to add the prefix 'btn-' to the name so it would be 'btn-off_style'. Yeah, this is begging for a more elegant solution, I know..

titse commented 6 years ago

Okay! I shall take a look! Thank you!

titse commented 6 years ago

Would it be possible you push fix#22 to npm? I close out this issue when Issue#22 has been completed

arnthor3 commented 6 years ago

Nice, I published, hope it works.

titse commented 6 years ago

Thanks!