# Rating

A level picked from a row of diamond pips.

[View Rating on CyberSpec](https://www.cyberspec.dev/components/sidebar/rating)

## Component

Rating belongs to the Choices group in the CyberSpec catalog. It uses @ui-sdk/react/rating.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/rating.json
```

## Example

```tsx
"use client"

import { Rating } from "@/components/ui/rating"

export default function RatingDemo() {
  return (
    <>
      <Rating label="Threat" defaultValue={3} levels={["Low", "Guarded", "Elevated", "High", "Severe"]} />
      <Rating label="Heat" defaultValue={1.5} step={0.5} max={4} />
      <Rating label="Clearance" value={2} levels={["Street", "Contract", "Vault"]} max={3} hint="Set by Vanta Systems." disabled />
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/rating-demo.json
```

## Resources

- [Interactive Rating preview](https://www.cyberspec.dev/preview/rating)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Rating source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/rating.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/rating.json)
