rating
Ratings give users a way to quickly view and provide feedback. Integrates with standard form elements.
Usage
rating(label="Rate this" value=3)Labels
Always provide a label for assistive devices β it is not displayed visually but is required for accessibility.
rating(label="Rate this component")Maximum Value
Use max to change the highest rating. Default is 5.
rating(label="Rating" max=3)rating(label="Rating" max=10)Precision
Use precision to allow fractional ratings.
rating(label="Rating" precision=0.5 value=2.5)Sizing
Use size to adjust the component size.
rating(label="Rating" size="small")rating(label="Rating" size="medium")rating(label="Rating" size="large")Readonly
Use readonly to display a rating that users cannot change.
rating(label="Rating" readonly value=4)Disabled
Use disabled to prevent all interaction.
rating(label="Rating" disabled value=3)Attributes
| Name | Type | Default | Description |
|---|---|---|---|
label | string | '' | Accessible label for assistive devices (not displayed visually). |
value | number | 0 | The current rating value. |
max | number | 5 | The highest rating to show. |
precision | number | 1 | Increment precision. Use 0.5 for half-star ratings. |
size | 'small' | 'medium' | 'large' | 'medium' | The componentβs size. |
readonly | boolean | false | Prevents user interaction without disabling the element. |
disabled | boolean | false | Disables the rating entirely. |
required | boolean | false | Makes the rating required in a form context. |
name | string | null | Form field name submitted with form data. |