Ratings

Ratings styling mixins are based on using font icons as rate symbols. There are two types of ratings: rating which allows user to vote and rating which displays voting results summary. Depending on the rating type mixin .lib-rating-vote() or .lib-rating-summary() is used.

Global rating variables

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

Rating with vote

To implement rating with vote, use the .lib-rating-vote() mixin.

.example-ratings-1 {
    .lib-rating-vote();
}

Rating with vote icons number customization

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
    );
}

Rating with vote icons colors customization

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
    );
}

Rating with vote icons symbol customization

To set custom icon symbol, use the @_icon-content variable

.example-ratings-4 {
    .lib-rating-vote(
        @_icon-content: @icon-wishlist-full
    );
}

Accessible rating with vote

The following markup corresponds to accesibility demands

.exapmle-ratings-5 {
    .control.rating.vote {
        .lib-rating-vote();
    }
}

Rating summary

To implement rating summary, use the following markup

.example-rating-summary-1 {
    .lib-rating-summary();
}

Rating summary icons number customization

To set up number of icons, use the variable:

  @_icon-count: number
.example-rating-summary-2 {
    .lib-rating-summary(
        @_icon-count: 8
    );
}

Rating summary icons color customization

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
    );
}

Rating summary icons symbol customization

To set up the icons symbol use variable:

  @_icon-content: icon_code
.example-rating-summary-4 {
    .lib-rating-summary(
        @_icon-content: @icon-wishlist-full
    );
}

Rating summary hide label

To hide the rating summary label set:

  @_label-hide: true
.example-rating-summary-5 {
    .lib-rating-summary(
        @_label-hide: true
    );
}

Rating summary multiple ratings

.example-rating-summary-6 {
    .rating-summary {
        .lib-rating-summary();
    }
}

Rating hide label mixin

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();
}