Skip to content

Commit 6e8e262

Browse files
committed
Merge pull request flatlogic#55 from vdh/variable_fix
Variable defaults, and a fix for the Opera styles
2 parents 5c302d1 + 196158f commit 6e8e262

6 files changed

+85
-31
lines changed

README.md

+71-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Awesome Bootstrap Checkbox
22
==========================
33

4-
Font Awesome Bootstrap Checkboxes & Radios plugin. Pure css way to make inputs look prettier. **No javascript**!
4+
[Font Awesome][] [Bootstrap][] Checkboxes & Radios plugin. Pure CSS way to make inputs look prettier. **No Javascript!**
55

6-
**[Demo](http://flatlogic.github.io/awesome-bootstrap-checkbox/demo/)**
6+
**[Demo][]**
77

88
Use
99
------------
1010

11-
First just include **awesome-bootstrap-checkbox.css** somewhere in your html. Or **awesome-bootstrap-checkbox.scss** if you use sass.
12-
Next everything is based on code convention. Here is checkbox markup from Bootstrap site:
11+
First just include **awesome-bootstrap-checkbox.css** somewhere in your HTML, or add the equivalent files to your [Sass](#using-sass) / [Less](#using-less) configuration.
12+
Next, everything is based on code convention. Here is checkbox markup from Bootstrap site:
1313

1414
````html
1515
<form role="form">
@@ -85,37 +85,87 @@ You may use `checkbox-primary`, `checkbox-danger`, `radio-info`, etc to style ch
8585

8686
`checkbox-single` and `radio-single` for inputs without label text.
8787

88-
Glyphicons way (Opt-out Font Awesome)
88+
Using [Sass][]
89+
----------
90+
91+
As per example in the `demo` folder, to use Font Awesome you'll have to `@import` the following library parts:
92+
93+
````scss
94+
@import "../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/variables";
95+
@import "../bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/mixins";
96+
97+
@import "../bower_components/Font-Awesome/scss/variables";
98+
99+
@import "../awesome-bootstrap-checkbox";
100+
````
101+
102+
Adjust this to the path where your bootstrap and font-awesome files are located.
103+
104+
Using [Less][]
105+
----------
106+
107+
Just like the Sass setup, you'll have to `@import` the following library parts:
108+
109+
````less
110+
@import "../bower_components/bootstrap/less/variables";
111+
@import "../bower_components/bootstrap/less/mixins";
112+
113+
@import "../awesome-bootstrap-checkbox";
114+
115+
@import "../bower_components/Font-Awesome/less/variables";
116+
````
117+
118+
Custom icon font
89119
------------
90120

91-
If you want to use glyphicons instead of font-awesome then override `.checkbox` class:
92-
````css
93-
.checkbox input[type=checkbox]:checked + label:after {
94-
font-family: 'Glyphicons Halflings';
95-
content: "\e013";
96-
}
121+
If you want to use another icon font instead of Font Awesome, such as [Glyphicons][], override the default variables:
122+
````scss
123+
$font-family-icon: 'Glyphicons Halflings';
124+
$check-icon: "\e013";
125+
97126
.checkbox label:after {
98127
padding-left: 4px;
99128
padding-top: 2px;
100129
font-size: 9px;
101130
}
102131
````
103132

104-
Using SASS
105-
----------
133+
or for Less:
134+
````less
135+
@font-family-icon: 'Glyphicons Halflings';
136+
@check-icon: "\e013";
106137

107-
As per example in the `demo` folder, to use these **awesome** you'll have to `@import` the following library parts:
138+
// Same styles as the Sass example...
139+
````
108140

109-
````scss
110-
@import "../bootstrap/bootstrap/variables";
111-
@import "../bootstrap/bootstrap/mixins";
141+
Or for plain CSS, override the `.checkbox` class (and `.styled` class for Opera):
142+
````css
143+
input[type="checkbox"].styled:checked + label:after,
144+
input[type="radio"].styled:checked + label:after,
145+
.checkbox input[type=checkbox]:checked + label:after {
146+
font-family: 'Glyphicons Halflings';
147+
content: "\e013";
148+
}
112149

113-
@import "../font-awesome/variables";
150+
input[type="checkbox"].styled:checked label:after,
151+
input[type="radio"].styled:checked label:after,
152+
.checkbox label:after {
153+
padding-left: 4px;
154+
padding-top: 2px;
155+
font-size: 9px;
156+
}
114157
````
115158

116-
Adjust this to the path where your bootstrap and font-awesome files are located.
117-
118159
Credits
119160
------------
120161

121-
Based on [Official Bootstrap Sass port](https://github.com/twbs/bootstrap-sass) and awesome [Font Awesome](https://github.com/FortAwesome/Font-Awesome).
162+
Based on the [Official Bootstrap Sass port][Bootstrap Sass] and the awesome [Font Awesome][].
163+
164+
165+
[Demo]: http://flatlogic.github.io/awesome-bootstrap-checkbox/demo/
166+
[Bootstrap]: http://getbootstrap.com/
167+
[Bootstrap Sass]: https://github.com/twbs/bootstrap-sass
168+
[Font Awesome]: https://github.com/FortAwesome/Font-Awesome
169+
[Glyphicons]: http://getbootstrap.com/components/#glyphicons
170+
[Sass]: http://sass-lang.com/
171+
[Less]: http://lesscss.org/

awesome-bootstrap-checkbox.less

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// --------------------------------------------------
44

55
@font-family-icon: 'FontAwesome';
6+
@fa-var-check: "\f00c";
7+
@check-icon: @fa-var-check;
68

79
.checkbox-variant(@parent, @color) {
810
.@{parent} input[type="checkbox"]:checked + label,
@@ -67,7 +69,7 @@
6769

6870
&:checked + label::after{
6971
font-family: @font-family-icon;
70-
content: @fa-var-check;
72+
content: @check-icon;
7173
}
7274

7375
&:disabled + label{
@@ -195,8 +197,8 @@
195197
input[type="checkbox"],
196198
input[type="radio"] {
197199
&.styled:checked + label:after {
198-
font-family: 'FontAwesome';
199-
content: "\f00c";
200+
font-family: @font-family-icon;
201+
content: @check-icon;
200202
}
201203
& .styled:checked + label {
202204
&::before {

awesome-bootstrap-checkbox.scss

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55

66
$font-family-icon: 'FontAwesome' !default;
7+
$fa-var-check: "\f00c" !default;
8+
$check-icon: $fa-var-check !default;
79

810
@mixin checkbox-variant($parent, $color) {
911
#{$parent} input[type="checkbox"]:checked + label,
@@ -68,7 +70,7 @@ $font-family-icon: 'FontAwesome' !default;
6870

6971
&:checked + label::after{
7072
font-family: $font-family-icon;
71-
content: $fa-var-check;
73+
content: $check-icon;
7274
}
7375

7476
&:disabled + label{
@@ -197,8 +199,8 @@ $font-family-icon: 'FontAwesome' !default;
197199
input[type="checkbox"],
198200
input[type="radio"] {
199201
&.styled:checked + label:after {
200-
font-family: 'FontAwesome';
201-
content: "\f00c";
202+
font-family: $font-family-icon;
203+
content: $check-icon;
202204
}
203205
.styled:checked + label {
204206
&::before {

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"awesome-bootstrap-checkbox.css",
55
"awesome-bootstrap-checkbox.scss"
66
],
7-
"version": "0.3.5",
7+
"version": "0.3.7",
88
"homepage": "https://github.com/flatlogic/awesome-bootstrap-checkbox",
99
"authors": [
1010
"okendoken flatlogic.com"

demo/build.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import "../bower_components/bootstrap/less/variables";
22
@import "../bower_components/bootstrap/less/mixins";
33

4-
@import "../bower_components/Font-Awesome/less/variables";
4+
@import "../awesome-bootstrap-checkbox";
55

6-
@import "../awesome-bootstrap-checkbox";
6+
@import "../bower_components/Font-Awesome/less/variables";

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "awesome-bootstrap-checkbox",
3-
"version": "0.3.6",
3+
"version": "0.3.7",
44
"description": "Font Awesome Bootstrap Checkboxes & Radios. Pure css way to make inputs look prettier.",
55
"main": "awesome-bootstrap-checkbox.css",
66
"scripts": {

0 commit comments

Comments
 (0)