Render one RatingItem for each star, and show the average next to it with RatingDisplay, which no one can change.
stay-rating.tsx
Rating
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| children | ReactNode | — | RatingItem parts. Leave it out to get max items. | ||||||||||||||||||||||||||
| size | "default""lg""sm" | — | |||||||||||||||||||||||||||
| class | string | — | |||||||||||||||||||||||||||
| value | number | null | — | The score, or null for no score. Controlled. | ||||||||||||||||||||||||||
| default | number | null | null | The first score when uncontrolled. | ||||||||||||||||||||||||||
| on | — | Runs on each change, also on a clear (null). Call eventDetails.cancel to stop it. | |||||||||||||||||||||||||||
| max | number | 5 | The number of stars. | ||||||||||||||||||||||||||
| step | 0.51 | 1 | 1: whole stars. 0.5: half stars, two radios per star. | ||||||||||||||||||||||||||
| clearable | boolean | false | A press on the current score clears it to null. | ||||||||||||||||||||||||||
| icon | Icon | StarIcon | The icon of a star: any Phosphor icon (HeartIcon); it draws in its fill and regular weights. | ||||||||||||||||||||||||||
| get | starLabel | The accessible name of each choice. Default: "1 star", "2.5 stars". | |||||||||||||||||||||||||||
| glow | boolean | — | A soft halo on the filled stars (glow, @gelatin-ui/glow). Default: false. | ||||||||||||||||||||||||||
From Base UIRadioGroupBase UI docs | |||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||||||
| read | boolean | false | Whether the user should be unable to select a different radio button in the group. | ||||||||||||||||||||||||||
| required | boolean | false | Whether the user must choose a value before submitting a form. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||||||
RatingItem
<span>| Prop | Type | Default | Description | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||
| value | number | — | The number of the star, 1 to max. With step={0.5} its halves are value − 0.5 and value. | ||||||||||||||||||||||
From Base UIRadio.RootBase UI docs | |||||||||||||||||||||||||
| disabled | boolean | — | Whether the component should ignore user interaction. | ||||||||||||||||||||||
| required | boolean | — | Whether the user must choose a value before submitting a form. | ||||||||||||||||||||||
| read | boolean | — | Whether the user should be unable to select the radio button. | ||||||||||||||||||||||
| |||||||||||||||||||||||||
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. | ||||||||||||||||||||||
RatingDisplay
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| size | "default""lg""sm" | — | |
| value | number | — | The score to show, any fraction (4.3). It is clamped to 0 to max. |
| max | number | 5 | The number of stars. |
| icon | Icon | StarIcon | The icon of a star, as on Rating. |
| glow | boolean | — | A soft halo on the filled stars (glow, @gelatin-ui/glow). Default: false. |
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
| Arrow RightorArrow Down | Moves to the next higher score and chooses it. With step={0.5}, it moves by half a star. |
|---|---|
| Arrow LeftorArrow Up | Moves to the next lower score and chooses it. |
| Space | With clearable, on the current score: clears the score. |
| Tab | Leaves the group. |





