Components · Forms · Rating
Back to Rating typesRating
Use for letting someone score something on a simple 0-5 scale, like a product review or a satisfaction survey - a row of identical icon buttons that fill in as the user hovers or taps, one Rating component controlled by properties, not five one-off icons glued together.
Properties
Icon size, label and selected count are properties of the same component, not separate icons - change them below to check this control's style and states in the Live Preview.
Live Preview
Both icon types compared side by side, each in all 6 states. Rest, Hover and Disabled always show the icon's unrated appearance (0 filled) - Hover additionally previews the first 3 icons in a lighter tint to suggest a live hover interaction - while Selected and Focused fill in the chosen number of icons. One full matrix is rendered per selected Icon size, at the chosen Label and Selected count.
Try it
A real, working Star rating - click an icon to score, hover to preview, or focus the row and use the Left/Right arrow keys (Home/End to jump to the bounds). The Heart type's interactive instance and half-star ratings aren't built here - this demonstrates the click/hover/keyboard model, which is identical for both icon types.
When to use
Any place someone scores something on a simple, bounded scale, from zero up to a small fixed maximum.
Validation
A rating scale has no natural "empty" glyph distinct from "empty because unanswered" - for a typical 1-5 icon row with nothing clicked, zero filled icons and a required-but-missing answer look identical, so the required state has to be carried by the label and the error, not by the icons themselves.
- Required marking - put the red asterisk next to the label, same as any other required field, since the icon row itself can't show it.
- Validation timing - validate on submit, not on blur - there's no natural blur moment for a row of icon buttons the way there is for a text field, and validating after every hover/click would flag the field before the user has finished deciding.
- Error message - "Choose a rating before submitting," not "This field is required" - the message should name the action (choose a rating) instead of describing the field abstractly.
- Recovery - focus the first icon and keep the error visible next to the label until a value is picked - clicking any icon should clear it immediately, since a single click is a complete, valid answer.
Component Guide
Overview
Rating is a row of identical icon buttons (stars or hearts) that fill in as the user hovers or taps, letting someone score something on a simple, bounded scale - built for quick, low-friction feedback rather than precise numeric entry.
When to Use
- A product or service review score - a 0-5 star rating.
- A quick satisfaction survey question - how satisfied were you, on a small fixed scale.
- A content quality score - used internally to flag good or poor examples.
When Not to Use
- A precise numeric value - use Number - Rating is for a small, discrete, low-precision scale, not exact figures.
- A scale bigger than a handful of points - beyond roughly 5-10 points, individual icons stop being scannable at a glance; consider Slider or Number instead.
- A binary yes/no signal - use Switch or a simple Checkbox rather than a rating scale for a single up/down choice.
Best Practices
- Preview the would-be selection on hover before it's committed by a click/tap, so users can see what they're about to choose.
- Keep the icon count small and fixed (commonly 5) - a rating scale should be scannable in a single glance.
- Pair the icon row with a numeric or text label when precision matters (e.g. "4.5 out of 5"), since icons alone can't show fractional values clearly.
Do and Don't
Do
A single five-point scale for one clear question - quick to answer and quick to read back in aggregate.
Don't
Four scales turn a two-second reaction into a survey, and most people abandon it rather than score every dimension.
Accessibility
- Each icon is an independently focusable, labeled control ("Rate 3 out of 5"), not one giant unlabeled row.
- The current and hovered/previewed value are both announced to assistive technology, not communicated by fill color alone.
- Fully operable by keyboard - arrow keys move between values, Enter/Space commits the selection.
Related Components
Slider, Number, Badge.
{
"component": "Rating",
"category": "Forms",
"summary": "Rating is a row of identical icon buttons (stars or hearts) that fill in as the user hovers or taps, letting someone score something on a simple, bounded scale - built for quick, low-friction feedback rather than precise numeric entry.",
"whenToUse": [
"A product or service review score - a 0-5 star rating.",
"A quick satisfaction survey question - how satisfied were you, on a small fixed scale.",
"A content quality score - used internally to flag good or poor examples."
],
"whenNotToUse": [
"A precise numeric value - use Number - Rating is for a small, discrete, low-precision scale, not exact figures.",
"A scale bigger than a handful of points - beyond roughly 5-10 points, individual icons stop being scannable at a glance; consider Slider or Number instead.",
"A binary yes/no signal - use Switch or a simple Checkbox rather than a rating scale for a single up/down choice."
],
"bestPractices": [
"Preview the would-be selection on hover before it's committed by a click/tap, so users can see what they're about to choose.",
"Keep the icon count small and fixed (commonly 5) - a rating scale should be scannable in a single glance.",
"Pair the icon row with a numeric or text label when precision matters (e.g. \"4.5 out of 5\"), since icons alone can't show fractional values clearly."
],
"doAndDont": {
"do": "A single five-point scale for one clear question - quick to answer and quick to read back in aggregate.",
"dont": "Four scales turn a two-second reaction into a survey, and most people abandon it rather than score every dimension."
},
"accessibility": [
"Each icon is an independently focusable, labeled control (\"Rate 3 out of 5\"), not one giant unlabeled row.",
"The current and hovered/previewed value are both announced to assistive technology, not communicated by fill color alone.",
"Fully operable by keyboard - arrow keys move between values, Enter/Space commits the selection."
],
"relatedComponents": [
"Slider",
"Number",
"Badge"
]
}