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#

TSX
import { Rating, Row, Col, Text, Card } from '@sigx/daisyui';

Basic Usage#

TSX
Loading preview...

Sizes#

All five size variants: xs, sm, md, lg, xl.

TSX
Loading preview...

Colors#

TSX
Loading preview...

Mask Shapes#

Different shapes for rating icons using the mask prop.

TSX
Loading preview...

Half Stars#

Enable half-star ratings for more precise feedback using the half prop.

TSX
Loading preview...

Read-Only#

Display ratings without user interaction using the readOnly prop.

TSX
Loading preview...

Hidden (Clearable)#

The component includes a hidden first radio input so the user can deselect all stars (clear the rating to 0).

TSX
Loading preview...

Custom Max#

TSX
Loading preview...

Props#

PropTypeDefaultDescription
model() => signal.property-Model binding for rating value
maxnumber5Maximum 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)
halfbooleanfalseEnable half-star ratings
readOnlybooleanfalseDisable user interaction
classstring-Additional CSS classes

Events#

EventTypeDescription
onChange(value: number) => voidFired when rating changes