# Rating (UI SDK): Deselectable

> With `deselectable`, pressing the checked star again clears the score.

Canonical: https://hextaui.com/docs/ui-sdk-rating/examples/deselectable

Component docs: https://hextaui.com/docs/ui-sdk-rating

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/ui-sdk-rating-deselectable.json
```

This adds `components/examples/ui-sdk-rating/deselectable.tsx` with the Rating component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/ui-sdk-rating/deselectable.tsx"
import { Rating, RatingItem } from "@/components/ui/ui-sdk-rating"

function UiSdkRatingDeselectable() {
  return (
    <Rating aria-label="Rating" deselectable defaultValue={2}>
      <RatingItem />
    </Rating>
  )
}

export { UiSdkRatingDeselectable }
```

## Props in this example

### Rating

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `number \| null` | – |  |
| `deselectable` | `boolean` | `false` |  |

## More Rating examples

- [Half stars](https://hextaui.com/docs/ui-sdk-rating/examples/half)
- [Read-only](https://hextaui.com/docs/ui-sdk-rating/examples/read-only)
- [Sizes](https://hextaui.com/docs/ui-sdk-rating/examples/sizes)
- [Controlled](https://hextaui.com/docs/ui-sdk-rating/examples/controlled)
- [Form](https://hextaui.com/docs/ui-sdk-rating/examples/form)
- [Custom icon](https://hextaui.com/docs/ui-sdk-rating/examples/custom-icon)
- [Disabled](https://hextaui.com/docs/ui-sdk-rating/examples/disabled)
- [Right to left](https://hextaui.com/docs/ui-sdk-rating/examples/rtl)
