UI Toolbox logoUI Toolbox

Rating

A Rating is a row of stars that shows and sets a rating from 0 to Max. Its value is a float.

<UIToolbox.Rating label="Rating" value="3.5" allow-half="true" />
<UIToolbox.Rating value="4.5" read-only="true" symbol="♥" />
Member Description
Max (max) The number of stars (5). The smallest is 1. Fewer stars clamp the value.
AllowHalf (allow-half) A click on the left half of a star, and the keys, set half steps.
ReadOnly (read-only) Shows the rating and ignores the pointer and the keys.
Symbol (symbol) The text of one star (★). Any glyph in the font works.
Image (image) An image for each star instead of Symbol: a texture, sprite or vector image. The USS tint colors the empty and the filled stars, so use a white image.

Styling

Class Element
tb-rating The field.
tb-rating__star One star, in the muted color. With image, -unity-background-image-tint-color colors the image.
tb-rating__fill The clipped copy on top of a star. Its width shows a whole, half or empty star. Its label uses the warning color and takes the size and font size of tb-rating__star.
tb-rating--read-only On the field when read-only is set.
tb-rating--preview On the field while the pointer previews a rating.