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.
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
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
disabled | disabled | Greyed out and not interactive. | boolean | false |
label | label | Accessible name of the group (e.g. the question). The shadow root stops an outside label from naming it, so pass the text here. | string | undefined |
ratingCount | rating-count | Number of items in the scale. | number | 5 |
ratingType | rating-type | The 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' |
readonly | readonly | Show the value only: no hover, no clicks, not focusable. | boolean | false |
selectedRating | selected-rating | Current value (0 = none). Controlled from the parent. | number | 0 |
showLabel | show-label | Also 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. | boolean | false |
Events
| Event | Description | Type |
|---|---|---|
rating | Emitted 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