A huge library of Pure CSS Checkboxes for every taste.

  • By Aslam Shah
  • Last update: Dec 13, 2022
  • Comments: 7

CSS Checkbox Library npm version

Tons of Checkboxes

A huge collection of pure css checkboxes. Click Here for Demo

Compatible

  1. IE9+
  2. Chrome 49+
  3. Firefox 52+
  4. Safari 5+

How to use

  1. Install via NPM npm i css-checkbox-library or Download the Zip
  2. Import the checkboxes.min.css or checkboxes.css file from the dist folder.
  3. Use the checkbox design you like with the following markup. In the example below the class ckbx-square-1 is important.
<div class="ckbx-square-1">
  <input type="checkbox" checked id="ckbx-square-1-2" value="0" name="ckbx-square-1">
  <label for="ckbx-square-1-2"></label>
</div>

That's it.

You can checkout the DEMO to get HTML Code for each design. Just press the HTML button.

Buy Me a Coffee at ko-fi.com

Changelog

1.5.1

  • minor updates

1.5.0

  • Major changes, Size reduction and refactor thanks to @varunsridharan. (No breaking changes)

1.0.0

First verison released

Github

https://github.com/hunzaboy/CSS-Checkbox-Library

Comments(7)

  • 1

    [ Major Update ] : Major Refector & Reduced Overall Size

    @hunzaboy First of all thanks for the awesome library. :-) I have been using this in my project https://github.com/wponion/wponion for a while And your recent update which provided me with scss files so i worked on it and reduced css output size from combining all common css codes.

    | CSS File | Old Size | New Size | | ------------- | ------------ | ------------ | | checkboxes.css | 25.5 KB | 10.6 KB | | checkboxes.min.css | 20.4 KB | 8.72 KB |

  • 2

    Enhacement suggestion

    Great library. One problem i had was the need to have a unique id for each of the checkbox. It's easy to do with particular pages, but with a large system can be complicated (when you have custom controls and some other things).

    So, trying to not use the id to link the label and the input, i have this solution:

    <label> 
    <input type="checkbox" value="0">
         <span class="label"></span>
    </label>
    

    I put a label over all elements (get ridding of the needed id) and an span with .label class to maintain the use of the CSS's. Changing them to:

    :checked + .label:after {

    Using ".label", not "label"

    What do you think about the change?

  • 3

    How to use descriptive text for checkbox?

    First of, I love how easy and stylish the checkboxes look, this is definitely better than the default look. However, I am struggling to show text on the right of the checkbox. For example, when using .ckbx-style-13 then the checkbox is overlapping the actual text.

  • 4

    Checkbox doesn't effect if I click the checkbox

    2018-08-03 9 31 16 2018-08-03 9 33 18

    I'm making chrome extension, and I'd like to use css-checkbox-library. However, how many times I click, this checkbox doesn't change color.

    If table tr tag, checkbox does not effect?

    Thank you very much, and sorry unwell English.

  • 5

    Stopped it from interfering with other checkboxes

    Altered checkboxes.css to keep it from hiding checkboxes that aren't styled with this library. Without this, any checkboxes would be turned invisible, even if they didn't have the styled CSS switch. Now they are only affected if they're in the "ckbx-style-___" div.

    I also created a new checkboxes.min.css minified with YUI based on the altered checkboxes.css file.

    Feel free to re-do the minification, it's a little different looking than the previous one was, but the change seemed to affect to many places to correct minified CSS by hand.

    Hopefully this is a useful contribution to this project. It made my site work much better.

  • 6

    ckbx-style-15 issue with Bulma

    Hello @hunzaboy , I would like to use your checkboxes. However, I have a problem when I use it together with Bulma (0.9.1) as you can see on the screenshot:

    CheckboxIssue

    I've copied the code from your DEMO-Page:

                        <div class="ckbx-style-15">
                            <input type="checkbox" id="ckbx-style-15-1" value="0" name="ckbx-style-15">
                            <label for="ckbx-style-15-1"></label>
                        </div>
    

    As you can see, the 'X' (status false) is unfortunately not fully displayed as can be seen on your Demo page

    Do you have an idea for me?

    Thanks in advance

  • 7

    Update and refactor

    • No changes to styling
    • Only Package dependency changes
    • Removed Gulp/ Added parcel bundler and node-sass for building
    • Removed unused code from src files