HextaUI

Rating (UI SDK): Half stars

With step={0.5}, each half of a star is its own radio, and the arrow keys move by half a star.

import { Rating, RatingItem } from "@/components/ui/ui-sdk-rating"

function UiSdkRatingHalf() {
  return (
    <Rating aria-label="Rating" step={0.5} defaultValue={3.5}>
      <RatingItem />
    </Rating>
  )
}

export { UiSdkRatingHalf }

This adds the example as components/examples/ui-sdk-rating/half.tsx, together with the Rating component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-rating-half.json

To add only the component, follow the Rating installation.

Props in this example

The Rating props this example sets, from the API reference.

PropTypeDefault
defaultValue
number | null–
step
number1

Every prop is in the Rating API reference.

See them all, with keyboard support and accessibility notes, on the Rating page.