CSS and SASS library for Checkboxes and radio buttons that display fa-check icon from fontawesome.
NOTE: README Under constant update.
npm i @ellakcy/fa-checkbox
Built CSS is located at ./node_modules/dist/all.css
in this package. And you can Include it like this:
<link rel="stylesheet" type="text/css" href="node_modules/dist/all.css">
We also you can use cdenjs as well ad avoid npm install
:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css">
The library allows you to use the following classes from font awesome:
fa-check
: https://fontawesome.com/icons/check?f=classic&s=solidfa-square-check
: https://fontawesome.com/icons/square-check?f=classic&s=regular
That display the appropriate icon as its value. For the solid version of them also use the fa-solid
class.
As you can see place fa-check
class to checkbox html input. Replace it with fa-square-check
for the altenrate icon.
<input type="checkbox" class="fa-check" name="myRadioGroup">
<input type="checkbox" class="fa-square-check" name="myRadioGroup">
<input type="checkbox" class="fa-solid fa-check" name="myRadioGroup">
<input type="checkbox" class="fa-solid fa-square-check" name="myRadioGroup">
<input type="radio" class="fa-solid fa-check" name="myRadioGroup">
<input type="radio" class="fa-solid fa-square-check" name="myRadioGroup">
Same thing as checkboxes do apply in radio buttons as well.
Same thing does apply upon select and option:
Only
multiple
is supported. Class.solid
is not supported.
<select class="fa-square-check" multiple>
<option selected>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
</select>
<select class="fa-check" multiple>
<option selected>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
</select>
Supported only fr checkboxes and radio buttons.
Use border
class:
<input type="checkbox" class="fa-check border" name="myRadioGroup">
<input type="radio" class="fa-check border" name="myRadioGroup">
Use radius
class:
<input type="checkbox" class="fa-check radius" name="myRadioGroup">
<input type="radio" class="fa-check radius" name="myRadioGroup">
<input id="rs1" type="radio" class="fa-check" name="myRadioGroup">
<label for="rs1" class="strike">Milk</label>
<label class="strike">
<input id="rs6" type="radio" class="fa-check" name="myRadioGroup">
Bread
</label>
<input id="rs1" type="checkbox" class="fa-check" name="myRadioGroup"><label for="rs1" class="strike">Milk</label>
<label class="strike">
<input id="rs6" type="checkbox" class="fa-check" name="myRadioGroup">
Bread
</label>
At code bellow the Option1
and Option2
will have strikethrough as text styling
<select class="strike" multiple>
<option selected>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
</select>
At code bellow the Option3
will have strikethrough as text styling
<select class="strike-opposite" multiple>
<option selected>Option 1</option>
<option selected>Option 2</option>
<option>Option 3</option>
</select>
Look at index.html in this project.
Read LICENCE.md file