Spectrum Components API

Schema version: 6.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.

PropertyValuesDefault valueRequired
value
yes / no
nono
is emphasized
yes / no
no
is disabled
yes / no
no
state
default / hover / down / keyboard focus
default
{
  "slug": "rating",
  "$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/component.json",
  "$id": "https://opensource.adobe.com/spectrum-design-data/schemas/components/rating.json",
  "title": "Rating",
  "description": "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.",
  "meta": {
    "category": "inputs",
    "documentationUrl": "https://spectrum.adobe.com/page/rating/"
  },
  "type": "object",
  "properties": {
    "value": {
      "type": "number",
      "minimum": 0,
      "maximum": 5,
      "default": 0,
      "multipleOf": 0.5,
      "description": "From 0 to 5, can be a decimal to represent half stars"
    },
    "isEmphasized": {
      "type": "boolean",
      "default": false
    },
    "isDisabled": {
      "type": "boolean",
      "default": false
    },
    "state": {
      "type": "string",
      "enum": [
        "default",
        "hover",
        "down",
        "keyboard focus"
      ],
      "default": "default"
    }
  }
}
← Back to home