Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build accessible, unstyled Vue 3 components using Reka UI (formerly Radix Vue) with WAI-ARIA compliance.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
components/rating.md
1# Rating23Star rating input (v2.8.0)45**Parts:** `RatingRoot`, `RatingItem`, `RatingItemIndicator`67## RatingRoot89### Props1011| Prop | Type | Default |12| -------------- | ---------------------------- | -------------- |13| `as` | `AsTag \| Component` | `"div"` |14| `asChild` | `boolean` | - |15| `defaultValue` | `number` | - |16| `modelValue` | `number` | - |17| `length` | `number` | `5` |18| `step` | `1 \| 0.5 \| 0.25 \| 0.1` | `1` |19| `clearable` | `boolean` | - |20| `hoverable` | `boolean` | - |21| `disabled` | `boolean` | `false` |22| `orientation` | `"vertical" \| "horizontal"` | `"horizontal"` |2324### Emits2526| Event | Payload |27| ------------------- | ------------------- |28| `update:modelValue` | `[payload: number]` |2930### Slots3132| Slot | Type |33| ------------ | --------------------- |34| `modelValue` | `number \| undefined` |35| `items` | `number[]` |3637## RatingItem3839### Props4041| Prop | Type | Default |42| --------- | -------------------- | --------- |43| `as` | `AsTag \| Component` | `"label"` |44| `asChild` | `boolean` | - |45| `item` | `number` | required |4647### Slots4849| Slot | Type |50| ------- | ---------- |51| `steps` | `number[]` |5253## RatingItemIndicator5455### Props5657| Prop | Type | Default |58| --------- | -------------------- | -------- |59| `as` | `AsTag \| Component` | - |60| `asChild` | `boolean` | - |61| `step` | `number` | required |6263### CSS Variables6465| Variable | Description |66| --------------------------------- | ---------------------- |67| `--reka-rating-item-step-width` | Width based on step |68| `--reka-rating-item-step-opacity` | Visibility of step |69| `--reka-rating-item-step-z-index` | Z-index stacking order |7071### Data Attributes7273| Attribute | Value |74| -------------- | ----------------------- |75| `[data-state]` | `"active" \| undefined` |7677## Example7879```vue80<script setup>81import { RatingRoot, RatingItem, RatingItemIndicator } from 'reka-ui'82const rating = ref(3)83</script>8485<template>86<RatingRoot v-model="rating" :length="5">87<template #default="{ items }">88<RatingItem v-for="item in items" :key="item" :item="item">89<template #default="{ steps }">90<RatingItemIndicator v-for="step in steps" :key="step" :step="step">91★92</RatingItemIndicator>93</template>94</RatingItem>95</template>96</RatingRoot>97</template>98```99