Version 2.0.0

Rating

The rating component lets users apply a rating to an item or experience, such as an image, a forum post, an item for sale in a marketplace, and more.

Three images with ratings below each of them showing four stars active out of 5, a pointer mouse hovering over the third star with three active, and a rating with all five stars in an inactive state.

Anatomy#


Image illustrating through labels the component parts of a rating with three stars filled in as active, including labels for its active stars and inactive stars.

Options#


Key example of two ratings, first rating with a value of 2 out of 5, second rating with a value of 5 out of 5.

Value#

The value is the number of the rating selected, on a sentiment scale from 0 to 5 (0 being the lowest, 5 being the highest).

Key example of four ratings, two ratings label not emphasized, two ratings label emphasized.

Emphasis#

By default, ratings are not emphasized (gray). This version is optimal for when the rating is not the core part of an interface, such as in application panels, where all visual components are monochrome in order to direct focus to the content.

The emphasized (blue) version provides a visual prominence that is optimal for forms, dialogs, and other situations where a rating needs to be noticed.

Key example of two ratings not emphasized and disabled, fist rating has no stars active, second rating has 3 stars active.

Disabled#

A rating in a disabled state shows that the component exists, but is not available in that circumstance. This can be used to maintain layout continuity and communicate that an action may become available later.

Table of options#

From the design point of view, each component has a number of options. These options and their names are platform agnostic, and each implementation should adapt these to fit into their framework.

PropertyValuesDefault Value
value
number (from 0 to 5)
is emphasized
yes / no
no
is disabled
yes / no
no

Behaviors#


Editing rating#

When interacting with a rating component that has a previously entered value, an underline appears under the current selection to provide context.

Clearing rating#

The rating can be cleared by clicking/tapping one more time on the “highest” star (e.g., the third star for a three-star rating). On keyboard focus, users can use the left/down arrow keys to decrease the rating until the last one is removed.

Key example showing empty rating.

Mixed value#

When representing multiple values (e.g., rating 2 photos at the same time), the rating is shown as empty if the ratings are not the same. This behavior is consistent with how a radio button group works, as well.

Key example of rating in Windows “high contrast black” theme in default and disabled states with selection of three stars out of five.

Windows high contrast mode#

In Windows high contrast mode, rating should be displayed using the high contrast theme-specified colors for buttons. By default, deselected star border and fill colors should be the same as the button text color. The selected star fill color for the emphasized option should be the same as button border color. In hover and keyboard focus states, the border colors should display as the button border color. In the disabled state, border and text color should display as the disabled color.

Rating (Windows high contrast mode) UI kit

Usage guidelines#


Don’t customize the number of stars available#

Star ratings should always have 5 available stars. This shouldn’t be increased or decreased to fit various containers.

Key example showing correct usage of rating. Star rating has three active stars out of five.
Key example showing incorrect usage of rating. Two ratings, first rating with 3 available stars, second rating with 6 available stars.

Keyboard interactions#


KeyInteraction
TabPlaces focus on the rating component. If focus is already on the rating component, the focus is moved to the next item in the page sequence.
Right/Up ArrowsIncreases the rating by one, up to 5.
Left/Down ArrowsDecreases the rating by one. If only one star remains, clears the rating completely.

Changelog#


DateNumberNotes
Jul 31, 20192.0.0
  • Replaced “standard/quiet” variants with emphasis (“emphasized/not emphasized”)
Apr 20, 20191.0.0
  • This component has been included to the website.

Design checklist#


All interactive states

Includes all interactive states that are applicable (hover, down, focus, keyboard focus, disabled).

All color themes

Works properly across all four color themes (lightest, light, dark, darkest).

All platform scales

Includes a desktop scale (UWP, macOS, web desktop) and a mobile scale (iOS, Android, web mobile).

Accessible use of color

Color is not used as the only visual means of conveying information (WCAG 2.0 1.4.1).

N/A

Accessible contrast for text

Text has a contrast ratio of at least 4.5:1 for small text and at least 3:1 for large text (WCAG 2.0 1.4.3).

Accessible contrast for UI components

Visual information required to identify components and states (except inactive components) has a contrast ratio of at least 3:1 (WCAG 2.1 1.4.11).

Content design

UI language and information design considerations have been incorporated into component design.

Defined options

Includes relevant options (variant, style, size, orientation, optional iconography, decorations, selection, error state, etc.)

Defined behaviors

Includes guidelines for keyboard focus, layout (wrapping, truncation, overflow), animation, interactions, etc.

Usage guidelines

Includes a list of dos and don'ts that highlight best practices and common mistakes.

N/A

Writing guidelines

Includes content standards or usage guidelines for how to write or format in-product content for the component.

N/A

Internationalization guidelines

Works properly across various locales and includes guidelines for bi-directionality (RTL).

Keyboard interactions

Follows WCAG 2.0 standards for keyboard accessibility guidelines and includes a description of the keyboard interactions.

Design tokens

All design attributes (color, typography, layout, animation, etc.) are available as design tokens.

UI kit

Includes a downloadable XD file that shows multiple options, states, color themes, and platform scales.

Generated UI kit

Includes a downloadable XD file, generated by code using design tokens defined in Spectrum DNA, and shows multiple options, states, color themes, and platform scales.

In Spectrum for Adobe XD plugin

Component is included in the Spectrum for Adobe XD plugin.