Rate
Documentation and examples for the Rate component.
Wann zu verwenden
- Bewertung anzeigen.
- Eine schnelle Bewertungsoperation für etwas.
Example Usage
astro
---
import Rate from '@/components/data-entry/Rate.astro';
---
<Rate value={4} max={5} /> Half-Stars
Enable half-star precision with the allowHalf prop.
astro
<Rate value={3.5} max={5} allowHalf={true} /> Colors and Icons
Customize the appearance with color and icon props.
astro
<Rate value={4} max={5} color="yellow" />
<Rate value={3} max={5} color="red" icon="Heart" />
<Rate value={5} max={5} color="green" icon="ThumbsUp" /> Sizes
astro
<Rate value={3} max={5} size="sm" />
<Rate value={3} max={5} size="md" />
<Rate value={3} max={5} size="lg" /> API
| Eigenschaft | Beschreibung | Typ | Standard |
|---|---|---|---|
| value | Aktueller Wert der Bewertung | number | 0 |
| max | Maximaler Bewertungswert | number | 5 |
| readonly | Wenn wahr, kann die Bewertung nicht geändert werden | boolean | false |
| name | Namensattribut für die versteckte Eingabe | string | 'rating' |
| icon | Symbol, das für die Bewertung verwendet werden soll | IconName | 'Star' |
| color | Farbvariante der Bewertungssterne | 'default' | 'yellow' | 'orange' | 'red' | 'green' | 'blue' | 'purple' | 'default' |
| allowHalf | Ob halbe Sterne-Bewertungen zulässig sind | boolean | false |
| size | Größe der Bewertungssymbole | 'sm' | 'md' | 'lg' | 'md' |
| error | Indicates an error state or displays an error message | string | boolean | |
| success | Indicates a success state or displays a success message | string | boolean | |
| disabled | Disables the component | boolean | false |