JSFiddle - React, Tailwind, and code Playground
by Jasper Stevens
HTML
<input id="shipping" class="input-checkbox" type="checkbox" name="ship_to_different_address" value="1">
<label for="shipping" class="checkbox">Ship to a other address?</label>
<br><br>
<input id="ideal" type="radio" class="input-radio" name="payment_method" value="ideal">
<label for="ideal" class="radio">iDEAL</label>
<input id="paypal" type="radio" class="input-radio" name="payment_method" value="paypal">
<label for="paypal" class="radio">Paypal</label>
CSS
input.input-checkbox[type=checkbox],
input.input-radio[type=radio] {
display: none;
}
label {
position: relative;
}
label.checkbox:before {
content: '';
display: inline-block;
position: relative;
top: 4px;
left: 0;
width: 20px;
height: 20px;
margin-right: 10px;
background: #fff;
border: 1px solid #222;
}
input[type="checkbox"]:checked + label:before {
background: green;
}
label.radio:before {
content: '';
display: inline-block;
position: relative;
top: 4px;
left: 0;
width: 20px;
height: 20px;
margin-right: 10px;
background: #fff;
border: 1px solid #222;
border-radius: 50%;
}
input[type="radio"]:checked + label:before {
background: green;
}