Demo and documentation
- Basic
- Shapes - Square, Curve, Round
- Variants - Default, Fill, Thick
- Colors - Primary, Success, Info, Warning, Danger
- Color types - Solid, Outline
- Animations - Smooth, Tada, Jelly, Pulse, Rotate
- Switch - iOS style - Outline, Fill, Slim
- Responsive
- No Javascript
- Custom Font Icons
- Svg Icons
- Image support
- Toggle between icons / svg's / images
- Lock
- State - Focus, Hover, Inderterminate
- Supports frameworks - Bootstrap, Foundation, Sematic UI, Bulma, ...
- Customize nearly everything with SCSS
- Print friendly
- and more... ( I am kidding, thats all! )
- From CLI
Install the library from npm
or yarn
package manager
> npm install pretty-checkbox // or
> yarn add pretty-checkbox
Add pretty-checkbox.min.css
in your html
- From CDN ( jsDelivr )
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pretty-checkbox@3/dist/pretty-checkbox.min.css"/>
- Manual download ( Github )
Download the source from github
<link rel="stylesheet" href="../<PATH>/pretty-checkbox/dist/pretty-checkbox.min.css"/>
<PATH>
is where the library is downloaded.
SCSS
You can also import pretty-checkbox.scss
in your main scss file.
@import '~pretty-checkbox/src/pretty.scss';
Please refer the document for SCSS settings.
Pretty checkbox comes with many styles,
Class name | Description |
---|---|
p-default |
Basic style |
p-switch |
iOS like toggle style |
p-icon |
Custom font icons |
p-svg |
Custom SVG files, markup |
p-image |
Tiny images |
And three shapes p-round
p-curve
p-square
(default)
<div class="pretty p-default">
<input type="checkbox" />
<div class="state">
<label>Check me</label>
</div>
</div>
Basic checkbox has three variants p-fill
p-thick
p-outline
(default)
You can combine them.
<div class="pretty p-default p-curve p-fill">
<input type="checkbox" />
<div class="state">
<label>Fill</label>
</div>
</div>
Switch has three variants p-outline
p-fill
p-slim
<div class="pretty p-switch p-fill">
<input type="checkbox" />
<div class="state">
<label>On</label>
</div>
</div>
<div class="pretty p-icon">
<input type="checkbox">
<div class="state">
<i class="icon fa fa-check"></i>
<label>Check me</label>
</div>
</div>
Note: class `icon` should be added along with icon class names
Note: For icons to work, you need to add appropriate font icons library. In above example , we used font awesome icon. So, FontAwesome should be included separately.
Checkout the documentation for tested font icon libraries.
<div class="pretty p-svg">
<input type="checkbox">
<div class="state">
<img class="svg" src="file.svg" />
<label>Check me</label>
</div>
</div>
Support, SVG file in img tag, svg markup (<svg> ... </svg>
)
Note: class `svg` to be added in img tag or svg tag.
Checkout the documentation for different formats and tested svg libraries.
<div class="pretty p-image">
<input type="checkbox" />
<div class="state">
<img class="image" src="/check.png" />
<label>Block</label>
</div>
</div>
Supports any type of valid image format.
Note: class `image` to be added in img tag.
Checkout the documentation for different formats and tested svg libraries.
There are five solid colors p-primary
p-success
p-warning
p-info
p-danger
And five outline colors p-primary-o
p-success-o
p-warning-o
p-info-o
p-danger-o
<div class="pretty p-default p-curve p-thick">
<input type="checkbox" />
<div class="state p-warning">
<label>Warning</label>
</div>
</div>
Note: Color class must be added in state class. Solid colors and Ouline colors have distinct role in font icons and toggle feature.
Checkout the documentation for complete demo of color combinations with above styles.
There are more features like Radio buttons , Toggle , States , Animations , Border less , Lock , Scale, SCSS Settings.
Please refer the documentation to know about them.
Works in all latest browsers.
Chrome >= 26
Firefox >= 16
Safari >= 6.1
Opera >= 15
IE >= 9
- Font awesome
- Bootstrap Glyphicons
- Material icon ( MDI )
- Material icon ( ZMDI )
- Ion icons
- Typicons
- Material icon ( Google )
- Others not tested, but will work ( 99% ).
- awesome-bootstrap-checkbox - Idea
- Animista - Animations
Thanks to all those good people who spend their valuable time and helped to improve this library. Any Contributions are welcome!
This project is licensed under the MIT License