# RatingBreakdown

> A reviews summary: the average score set large beside a star and the review count, then groups of bars, one per star level or per category.

```ts
import { RatingBreakdown } from "@sdxc/ui/travel";
```

Renders the summary: a `<section>` opening with the score, its star and the review count,
followed by its RatingBreakdown.Group children. A screen reader hears the score as
"4.86 out of 5".

## Examples

```tsx
<RatingBreakdown score={4.86} count="128 reviews">
	<RatingBreakdown.Group kind="stars" aria-label="Ratings by star">
		<RatingBreakdown.Bar label="5 stars" value={0.92} display="92%" />
	</RatingBreakdown.Group>
</RatingBreakdown>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `score` | `number` | The average rating, such as `4.86`. |
| `max?` | `number` |  |
| `display?` | `string` | The score as shown, already formatted for the reader's locale. |
| `count?` | `RemixNode` | The review count as shown, such as "128 reviews". |
| `outOf?` | `string` | What follows the score for a screen reader, completing "4.86 out of 5". |

Also accepts everything in `TagProps<"section">`.


### RatingBreakdown.Group

Renders a list of bars of one kind: star levels one under another, or categories in a grid that runs two to a row once the summary is 30rem wide.

| Prop | Type | Description |
| --- | --- | --- |
| `kind` | `"stars" \| "categories"` |  |

Also accepts everything in `TagProps<"ul">`.


### RatingBreakdown.Bar

Renders one bar as an ARIA meter named by `label` and valued by `display`, filled to `value / max` of its track; the figure at its end is hidden from assistive technology, which reads it as the meter's value.

| Prop | Type | Description |
| --- | --- | --- |
| `label` | `string` | What the bar measures, such as "5 stars" or "Cleanliness"; it names the meter. |
| `icon?` | `RemixNode` | Drawn before the label, such as a star or a category's icon. |
| `value` | `number` | The measured amount: a share from 0 to `max`, or a category's score. |
| `max?` | `number` |  |
| `display` | `string` | The figure shown at the bar's end and read as its value, such as "92%" or "4.9". |

Also accepts everything in `Omit<TagProps<"li">, "children">`.


## Types

| Name | Values | What it decides |
| --- | --- | --- |
| `Kind` | `"stars" \| "categories"` | `"stars"` sets each bar on one line, label and figure either side of it, for the share of reviews at each star level; `"categories"` sets the label over its bar, two to a row when there is room, for per-category scores. |
