Rating
Rating component allows users to provide feedback using stars or other shapes. Supports sizes, half-star ratings, mask shapes, colors, and model binding.
Import
import { Rating, Row, Col, Text, Card } from '@sigx/daisyui';
Basic Usage
Loading preview...
Sizes
All five size variants: xs, sm, md, lg, xl.
Loading preview...
Colors
Loading preview...
Mask Shapes
Different shapes for rating icons using the mask prop.
Loading preview...
Half Stars
Enable half-star ratings for more precise feedback using the half prop.
Loading preview...
Read-Only
Display ratings without user interaction using the readOnly prop.
Loading preview...
Hidden (Clearable)
The component includes a hidden first radio input so the user can deselect all stars (clear the rating to 0).
Loading preview...
Custom Max
Loading preview...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
model | () => signal.property | - | Model binding for rating value |
max | number | 5 | Maximum number of stars |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Size of the rating icons |
mask | 'star' | 'star-2' | 'heart' | 'circle' | 'diamond' | 'hexagon' | 'decagon' | 'triangle' | 'star-2' | Shape of the rating icons |
color | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | - | Color of filled icons (defaults to orange) |
half | boolean | false | Enable half-star ratings |
readOnly | boolean | false | Disable user interaction |
class | string | - | Additional CSS classes |
Events
| Event | Type | Description |
|---|---|---|
onChange | (value: number) => void | Fired when rating changes |