Ratings let users see and/or set a star rating for a product or other item.
Component
Rating
18 examples
Rate
Ant Design
Ant Financial
- React
- Code examples
- Accessibility issues
- Open source
Star rating
Backpack
Skyscanner
- Mobile
- React
- Code examples
- Usage guidelines
- Open source
- Tone of voice
Rating
Base Web
Uber
- React
- CSS-in-JS
- Code examples
- Usage guidelines
- Open source
Ratings
BBC Global Experience Language
- Accessibility
- Usage guidelines
- Unmaintained
Rating
Cedar
Recreational Equipment, Inc.
- Vue
- Sass
- CSS Modules
- Usage guidelines
- Code examples
- Open source
Star rating
eBay MIND Patterns
- Accessibility
- Usage guidelines
- Open source
Rating
Flowbite
- Tailwind CSS
- Open source
- Code examples
Rating
Fluent UI
Microsoft
- React
- Web Components
- Mobile
- Usage guidelines
- Code examples
- Accessibility
- Open source
Rating
Instructure-UI
Instructure
- React
- CSS-in-JS
- Code examples
- Accessibility
- Open source
Globe rating
Morningstar Design System
- Vue
- Usage guidelines
Medalist rating
Morningstar Design System
- Vue
- Usage guidelines
Star rating
Morningstar Design System
- Vue
- Usage guidelines
Rating
Quasar Framework
- Vue
- Accessibility issues
- Code examples
- Open source
Rating
Shoelace
- Web Components
- Code examples
- Open source
Rating
Spectrum
Adobe
- CSS
- Web Components
- React
- Code examples
- Usage guidelines
- Tone of voice
- Open source
Star Rating
Thumbprint
Thumbtack
- React
- Sass
- Code examples
- Open source
Star meter
Wanda
Wonderflow
- React
- CSS Modules
- Code examples
- Open source
Description
The rating component has two main functions:
- To display a single user's, or an aggregate, star rating for a product, service, page, or other entity (non-interactive)
- To let users set their own star rating (interactive)
Depending on the individual use case, the component may need to perform both of these functions or just one of them.
Markup and Accessiblity
Displaying a rating
When displaying a non-interactive rating you should provide accessible text describing the rating. For example, by using an image with an alt
attribute, Visually Hidden text, or an aria-label
attribute. Consider also rendering these text labels visually, not only to users of assistive technologies; they can be especially useful when displaying fractions of stars. e.g. '4.2/5.0'.
Setting a rating
An interactive rating component can be seen as a series of radio inputs with the values 0, 1, 2, 3, 4, 5. By default, this provides the following keyboard pattern for keyboard interaction:
- Tab to focus on the rating component (and move focus onto the next interactive element when pressed again)
- →/↓ to increase the rating by one star
- ←/↑ to decrease the rating by one star
The behaviour of left and right arrows is logical, but you may choose to do what Adobe Spectrum's rating component does and invert what the up and down arrows do: ↑ = +1 star and ↓ = -1 star.
In this example rating component from MUI both the input
and the label
for each option are visually hidden and a custom svg
is shown instead.