Rating
Rating composes individual rating buttons with controlled or default numeric value.
Practical React example
Collect one bounded rating while keeping the chosen value visible in text.
Before you copy and paste
Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/rating/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: @radix-ui/react-use-controllable-state, lucide-react.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Collect one bounded rating while keeping the chosen value visible in text
// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";
import { Rating, RatingButton } from "@/components/kibo-ui/rating";
const Example = () => (
<Rating defaultValue={3}>
{Array.from({ length: 5 }).map((_, index) => (
<RatingButton key={index} />
))}
</Rating>
);
export default Example;
Usage example adapted from Kibo UI's pinned MIT source. Retain the source licence notices when copying.
Choose the number of buttons to match your rating scale and persist the value only after application validation. Use readOnly for a displayed aggregate rather than an editable control.
Customization
- RatingButtonProps.index
- Optional; number.
- RatingButtonProps.icon
- Optional; ReactElement<LucideProps>.
- RatingProps.defaultValue
- Optional; number.
- RatingProps.value
- Optional; number.
- RatingProps.onChange
- Optional; ( event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>, value: number ) => void.
- RatingProps.onValueChange
- Optional; (value: number) => void.
- RatingProps.readOnly
- Optional; boolean.
- RatingProps.className
- Optional; string.
- RatingProps.children
- Optional; ReactNode.
Integration notes
- State clearly whether the number is this person’s rating or an aggregate from other people.
- Test arrow keys, focus, empty selection and a readable numeric label.
Component source: Kibo UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.