Rating
Shows a rating as stars or dots in the brand's rating colour, with an optional score and review count, at three sizes.
Parts
| Part | File | Does |
|---|---|---|
| Rating | Rating.vue | Shows a rating as filled and empty marks, with an optional value and review count; the brand's rating colour fills the marks. |
| RatingIcon | RatingIcon.vue | Shows one mark of the rating, either filled or empty. |
| RatingMeta | RatingMeta.vue | Shows the numeric rating and the number of reviews behind it. |
Anatomy
<Rating>
<RatingIcon />
<RatingMeta />
</Rating>Styling
All of Rating’s styles live in rating.json. New to styling in Frontic UI? How styling works →
Install
- Installs with it
- format
- npm packages
- @lucide/vue
- class-variance-authority
- reka-ui
API reference
Shows a rating as filled and empty marks, with an optional value and review count; the brand's rating colour fills the marks. Renders a <div>.
Props 8
| Prop | Type | Default | |
|---|---|---|---|
| class | ClassValue | — | |
| |||
| size | RatingSize | 'md' | |
| |||
| shape | 'star' | 'dot' | 'star' | |
| |||
| rating* | number | — | |
| |||
| max | number | 5 | |
| |||
| count | number | — | |
| |||
| showValue | boolean | false | |
| |||
| label | ((score: number, max: number, count?: number | undefined) => string) | `${score} out of ${max}${count ? `, ${count} ${count === 1 ? 'review' : 'reviews'}` : ''}` | |
| |||
Slots 1
| Slot | Slot props | |
|---|---|---|
| meta | { rating: number; max: number; count: number | undefined; } | |
| ||