Global styles for both types of ratings can be modified by changing global variables. To set different styles to types of ratings these variables should be used directly in the mixin call.
Mixin variable | Global variable | Default value | Allowed values | Comment |
---|---|---|---|---|
@_icon-content | @rating-icon__content | @icon-star | '' | false | icon code | Rating icon symbol code |
@_icon-count | @rating-icon__count | 5 | '' | value | Number of rating icon symbols |
@_icon-font | @rating-icon__font | @icon-font | '' | false | value | Icon font |
@_icon-font-size | @rating-icon__font-size | 28px | '' | false | value | Icon font size |
@_icon-letter-spacing | @rating-icon__letter-spacing | -10px | '' | false | value | Icon letter spacing |
@_icon-color | @rating-icon__color | #c7c7c7 | '' | false | value | Unselected icons color |
@_icon-color-active | @rating-icon__active__color | #ff5601 | '' | false | value | Selected and hovered icons color |
@_label-hide | @rating-label__hide | false | true | false | Rating label is displayed |
.example-ratings-1 {
.lib-rating-vote();
}
To change number of icons, add desired number of rating icons (input + label) to the markup. Then set this number to the @_icon-count
mixin variable.
.example-ratings-2 {
.lib-rating-vote(
@_icon-count: 8
);
}
These variables control default and active icon colors:
@_icon-color: value,
@_icon-color-active: value
.example-ratings-3 {
.lib-rating-vote(
@_icon-color: #aff5e3,
@_icon-color-active: #0a6767
);
}
To set custom icon symbol, use the @_icon-content
variable
.example-ratings-4 {
.lib-rating-vote(
@_icon-content: @icon-wishlist-full
);
}
.exapmle-ratings-5 {
.control.rating.vote {
.lib-rating-vote();
}
}
.example-rating-summary-1 {
.lib-rating-summary();
}
To set up number of icons, use the variable:
@_icon-count: number
.example-rating-summary-2 {
.lib-rating-summary(
@_icon-count: 8
);
}
To set up the icons default and selected color, use variables:
@_icon-color: value
@_icon-color-active: value
.example-rating-summary-3 {
.lib-rating-summary(
@_icon-color: #aff5e3,
@_icon-color-active: #0a6767
);
}
To set up the icons symbol use variable:
@_icon-content: icon_code
.example-rating-summary-4 {
.lib-rating-summary(
@_icon-content: @icon-wishlist-full
);
}
.example-rating-summary-5 {
.lib-rating-summary(
@_label-hide: true
);
}
.example-rating-summary-6 {
.rating-summary {
.lib-rating-summary();
}
}
The .lib-rating-summary-label-hide()
mixin is used to hide rating label in summary rating.
.example-rating-summary-7 {
.lib-rating-summary();
.lib-rating-summary-label-hide();
}