Rate
Documentation and examples for the Rate component.
いつ使うか
- 評価を表示します。
- 何かに対する素早い評価操作。
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
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| value | 評価の現在の値 | number | 0 |
| max | 最大評価値 | number | 5 |
| readonly | trueの場合、評価は変更できません | boolean | false |
| name | 隠し入力の名前属性 | string | 'rating' |
| icon | 評価に使用するアイコン | IconName | 'Star' |
| color | 評価星のカラーバリアント | 'default' | 'yellow' | 'orange' | 'red' | 'green' | 'blue' | 'purple' | 'default' |
| allowHalf | 半星評価を許可するかどうか | boolean | false |
| size | 評価アイコンのサイズ | '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 |