pretty-checkbox
pretty-checkbox copied to clipboard
Works with react-icons?
I have been trying to get the checkboxes to work with react-icons which uses SVGs
This is my code:
<div className="pretty p-svg p-curve">
<input type="checkbox" />
<div className="state p-success">
<FaCheck />
<label>Recurring</label>
</div>
</div>
but it's not working, is it compatible?
Hi @webbygregg ,
sorry for the late response. I havent tested with react. But will try and get back to you soon.
React works best if the input is "controlled" and so, you'll need to program the state and the behavior...
<input type="checkbox"
checked={this.state.checked}
onClick={e=>{
this.setState({checked: !this.state.checked});
}}
/>
*this.state.checked assumes you only have one checkbox in your component. You'll probably want a richer state variable.