Skip to content

Proposal: New native <rating> element for semantic reviews and interactive scores #12857

Description

@GrappinoRoot

What is the issue with the HTML Standard?

Description

I would like to propose a new native HTML element: <rating>.

Star ratings and review scores are among the most common UI components on modern e-commerce, media, and booking websites. However, HTML currently lacks a native way to represent or input these values. Developers are forced to build complex workarounds using hidden radio buttons, CSS hacks (~ selectors), or heavy JavaScript components.

A native <rating> element would provide a clean, declarative, and standardized way to handle both read-only scores and interactive inputs without any external code.

Proposed Syntax

<!-- Read-only mode (e.g., product review averages) -->
<rating value="4.3" max="5"></rating>

<!-- Interactive mode for forms -->
<rating name="user-score" value="0" max="5" interactive></rating>

Attributes

  • value (required): A decimal number representing the current score.
  • max (optional): The maximum number of stars/points. Defaults to 5.
  • interactive (optional): A boolean attribute. If present, it allows users to click/tap to change the value (behaving like a form input).
  • step (optional): Specifies the granularity of the value (e.g., 0.5 for half-stars). Defaults to 1.

Why this is needed (Key Problems Solved)

  1. Extreme Simplicity: Developers can implement a fully functional star-rating system with a single line of pure HTML, eliminating third-party JS plugins and complex CSS.
  2. Native Accessibility (A11y): Screen readers struggle with custom star components. A native <rating> element would automatically expose the correct semantics to the accessibility tree, reading out "Rating: 4.3 out of 5" naturally.
  3. SEO Optimization: Search engines can immediately index product scores directly from the HTML markup without relying on fragile regex parsing or mandatory JSON-LD boilerplate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions