Skip to main content
Version: 1.0.3

Rating

Overview

The Rating component provides a visual representation of a rating value using configurable indicators (default: stars). It supports both read-only display and optional interactive rating selection modes with beautiful animations.

Preview

Current rating: 2 / 5

Emoji Rating

Emoji Rating with Animations

Current rating: 0 / 5

Animation Type: spring • Try clicking and hovering!

Variants

Sizes

All Sizes

XS
SM
MD
LG
XL

Color Schemes

All Color Schemes

YELLOW
RED
BLUE
GREEN
PURPLE
PINK
ORANGE
AMBER

Installation

ignix add component rating

Usage

Import the component:

import { Rating } from '@src/components/ui/rating';
import { Star } from 'lucide-react';

Basic Usage

function BasicRating() {
const [value, setValue] = useState(0);

return (
<Rating
value={value}
max={5}
interactive
iconType={Star}
onChange={setValue}
/>
);
}

Props

PropTypeDefaultDescription
valuenumberundefinedCurrent rating value (0 to max). If undefined, component manages its own state.
maxnumber5Maximum rating scale
interactivebooleanfalseWhether the rating is interactive
disabledbooleanfalseWhether the rating is disabled (only applies when interactive)
allowHalfbooleanfalseWhether to show half stars
showValuebooleanfalseWhether to show the numeric value
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Size of the rating stars
orientation'horizontal' | 'vertical''horizontal'Orientation of the rating
colorScheme'yellow' | 'red' | 'blue' | 'green' | 'purple' | 'pink' | 'orange' | 'indigo' | 'teal' | 'amber''yellow'Color scheme for filled icons
iconTypeLucideIconStarLucide icon component to use
emojistringundefinedSingle emoji to use for all rating items
emojisstring[]undefinedArray of emojis - one per rating item
emptyEmojistringundefinedEmoji for empty/unfilled items
animationType'bounce' | 'pulse' | 'fade' | 'slide' | 'rotate' | 'scale' | 'elastic' | 'spring' | 'glow' | 'shimmer' | 'none''spring'Animation type for star interactions
readOnlybooleanfalseRead-only mode (overrides interactive)
onChange(value: number) => voidundefinedCallback when value changes
onEmojiSelect(value: number, emoji: string) => voidundefinedCallback when emoji is selected (only for emoji mode)