SDAIA
SDAIA LogoSDAIA Logo
ComponentsRating
IntroductionInstallationFAQBrands
ColorsTypographySpacingRadiusGrid layoutsAll Tokens
All Components
AccordionActivityArea ChartAudio PlayerAvatarAvatarGroupCarousel ImageChartChipCode SnippetColumn ChartContext MenuDigital StampDividerDonut ChartDraggable ListDropdownEmpty StateFiltrationFooterImage ViewerLine ChartListMedia GalleryMenuMetricNav BarNav HeaderNumberPDF ViewerPie ChartPopoverProgress CircleQuoteRadial StepperScatterSecond Nav HeaderSlideout MenuStructured ListTableTable of ContentTree ViewVertical TabsVideo Player
BreadcrumbButtonButton MenuButton SplitContent SwitcherDate PickerFloating ButtonHorizontal TabsLinkModalPaginationRadio ButtonSwitchTag
AutocompleteCheckboxFile UploadNumber InputRange SliderRich Text EditorSelectSignatureSliderText AreaText Input
AlertsBadgeCardFeedbackFeedback OverviewHelp IconLoading IndicatorNotification BannerNotification PopupNotificationsProgress BarRatingRating OverviewSkeletonSkeleton/AvatarsTooltip
Sdaia Logo Animation
Sdaia Touch ButtonsSdaia Touch Switch

Rating

Rating displays a star-based scoring component with solid and outline styles, brand coloring, and multiple size options.

Loading preview…
1<Rating value={4.9} max={5} readOnly brand size="xl" />

Installation

npx sdaia-ui@latest add rating

Usage

import { Rating } from "@/components/ui/rating"
<Rating value={value} onValueChange={setValue} />

Examples

Default

The default rating component with solid stars in medium size.

Loading preview…
1const [value, setValue] = useState(3.5);
2
3<Rating value={value} onValueChange={setValue} />

Outline

Star rating with outlined (unfilled) star shapes.

Loading preview…
1<Rating style="outline" value={value} onValueChange={setValue} />

Solid

Star rating with solid filled star shapes.

Loading preview…
1<Rating style="solid" value={value} onValueChange={setValue} />

Brand

Star rating with brand colours applied.

Loading preview…
1<Rating
2 brand={true | false}
3/>

Sizes

Rating stars available in sizes from 2xSmall to 2xLarge.

Loading preview…
1<Rating size="2xs" defaultValue={3.5} />
2<Rating size="sm" defaultValue={3.5} />
3<Rating size="md" defaultValue={3.5} />
4<Rating size="lg" defaultValue={3.5} />
5<Rating size="2xl" defaultValue={3.5} />

API Reference

RatingProps

Props for the Rating component.

Prop

Type

Default

Required

value

number

-

optional

defaultValue

number

0

optional

max

number

5

optional

size

'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'

'md'

optional

style

'solid' | 'outline'

'solid'

optional

brand

boolean

true

optional

step

0.5 | 1

0.5

optional

direction

'ltr' | 'rtl'

'ltr'

optional

disabled

boolean

false

optional

readOnly

boolean

false

optional

hoverable

boolean

true

optional

starColor

string

-

optional

emptyStarColor

string

-

optional

onValueChange

(value: number) => void

-

optional
Progress Bar
Rating Overview
On this page
S

SDAIA Assistant

Productivity · Free

4.9

128K Ratings

Version 3.2.1

Updated 2 days ago

3.5 / 5