eds-rating

Explore the Interactive Component

Use the playground below to experiment with the component. Click the button to view the full Storybook deployment for additional examples and configurations.

eds-rating Open in Storybook

See It in Use with Code

Check out this practical implementation of component.

Plain HTML

In React

In Vue

Overview

A rating scale of stars (or thumbs). Bare icons: an outline when empty, filled when chosen, and hovering previews the fill up to the pointer. It behaves as a radio group: arrow keys move and select, Home/End jump to the ends, and a screen reader hears “3 of 5”. readonly shows a score without interaction.

Properties

PropertyAttributeDescriptionTypeDefault
disableddisabledGreyed out and not interactive.booleanfalse
labellabelAccessible name of the group (e.g. the question). The shadow root stops an outside label from naming it, so pass the text here.stringundefined
ratingCountrating-countNumber of items in the scale.number5
ratingTyperating-typeThe icon of each item: star, thumbs-up or thumbs-down. Every item is one step of the scale."copy" | "arrow-right" | "chevron-right" | "chevron-left" | "chevron-down" | "chevron-up" | "arrow-left" | "arrow-up-right" | "close" | "subtract" | "add" | "branch" | "history" | "locked" | "unlocked" | "edit" | "checkmark" | "download" | "upload" | "view" | "exit" | "caretSort" | "bookmark" | "createLink" | "activity" | "account" | "analytics" | "template" | "documentExport" | "documentDownload" | "trashCan" | "chooseItem" | "copyLink" | "dragHorizontal" | "dragVertical" | "login" | "logout" | "move" | "replicate" | "sortAscending" | "sortDescending" | "requestQuote" | "reset" | "resultDraft" | "share" | "play" | "book" | "chatOff" | "forum" | "shareKnowledge" | "time" | "help" | "customerService" | "code" | "rocket" | "compass" | "sparkle" | "menu" | "search" | "settings" | "notification" | "user" | "group" | "building" | "overflow" | "save" | "document" | "folder" | "image" | "calendar" | "information" | "warning" | "error" | "checkmark-filled" | "star" | "thumbs-up" | "thumbs-down" | "star-outline" | "thumbs-up-outline" | "thumbs-down-outline" | "twitter" | "linkedin" | "facebook" | "youtube" | "mastodon" | "bluesky" | "gitlab"'star'
readonlyreadonlyShow the value only: no hover, no clicks, not focusable.booleanfalse
selectedRatingselected-ratingCurrent value (0 = none). Controlled from the parent.number0
showLabelshow-labelAlso show label as a visible field label above the scale, in the same style as eds-input-field (eds-input-label). Off by default: eds-form and eds-feedback draw their own label or heading.booleanfalse

Events

EventDescriptionType
ratingEmitted with the new value when the user picks one.CustomEvent<number>

Dependencies

Used by

Depends on

Graph

graph TD;
  eds-rating --> eds-input-label
  eds-feedback --> eds-rating
  eds-form --> eds-rating
  style eds-rating fill:#f9f,stroke:#333,stroke-width:4px

Built with StencilJS