Back to Shark UI

Rating

docs/components/rating

latest7.0 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Rating

Copy Markdown

Show reviews and ratings in a visual format.

DocsAPI

PreviewCode

VV

Vinicius Vicentini

Tuestday morning at Mercado N.89

Rate your driver

Submit

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/rating

Usage#

import { RatingGroup } from "@/components/ui/rating";
<RatingGroup />

Controlled#

Use value and onValueChange to control the rating programmatically.

PreviewCode

Select the rating 5

States#

Readonly#

Use the readOnly prop to display a rating without interaction.

PreviewCode

Disabled#

Use the disabled prop to prevent interaction and show a disabled state.

PreviewCode

Examples#

Half star#

Use allowHalf to allow half-star selections.

PreviewCode

Count#

Use the count prop to show more or less stars.

PreviewCode

Testimonial#

Display a read-only rating inside a testimonial card.

PreviewCode

“This completely changed our workflow. Fast, reliable, and the team loves it. Would recommend to anyone.”

VV

Vinicius Vicentini

Frontend Developer

Customize size#

Use the className prop to set the size of the rating.

PreviewCode

Custom icon#

Compose the rating with a different icon.

PreviewCode

Custom color#

Override the filled color with className.

PreviewCode

API Reference#

Rating#

Root component.

PropTypeDefault
allowHalfbooleanfalse
countnumber5
defaultValuenumber-
valuenumber-
onValueChange(details: ValueChangeDetails) => void-
readOnlyboolean-
disabledboolean-
classNamestring-

For a complete list of props, see the Ark UI documentation.

[

Previous page

Radio Group ](/docs/components/radio-group)[

Next page

Resizable ](/docs/components/resizable)

On This Page

InstallationUsageControlledStatesReadonlyDisabledExamplesHalf starCountTestimonialCustomize sizeCustom iconCustom colorAPI ReferenceRating