Rating
Generated from public Vue/TypeScript exports by
pnpm docs:generate. Edit source comments and stories to update this reference. Types describe the declared API; browser/device constraints are covered in the guides. This catalog reflects source commitfc6bfb108634735f1657e533206c3f8702ad357d; match your installed package and typed manifest before using an export. Source review does not establish registry-release availability.
Rating
import { Rating } from '@gxp-dev/app-ui'
Props
| Name | Type | Required / default | Description |
|---|---|---|---|
modelValue | number | undefined | 0 | Current rating value (v-model). |
max | number | undefined | 5 | Number of stars to render. |
readonly | boolean | undefined | false | Render as a static, non-interactive display. |
disabled | boolean | undefined | false | Disable interaction while keeping the interactive markup. |
allowClear | boolean | undefined | true | Clicking the currently selected star clears the value back to 0. |
size | "default" | "sm" | "lg" | undefined | "default" | Icon size preset. |
label | string | undefined | "Rating" | Accessible label for the radiogroup. |
Events
| Name | Type | Required / default | Description |
|---|---|---|---|
update:modelValue | [payload: number] | — | — |
Slots
| Name | Type | Required / default | Description |
|---|---|---|---|
icon | { filled: boolean; index: number; } | — | — |
Examples
These are authored Storybook excerpts, not complete standalone modules. Relative imports refer to the story file; in an app import public components from @gxp-dev/app-ui. Default meta arguments are applied before each story.
Default
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { Heart } from 'lucide-vue-next'
import { Rating } from '.'
{
render: (args) => ({
components: { Rating },
setup() {
const value = ref(3)
return { args, value }
},
template: `
<div class="space-y-2">
<Rating v-bind="args" v-model="value" />
<p class="text-sm text-muted-foreground">Value: {{ value }}</p>
</div>
`,
}),
}
Readonly
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { Heart } from 'lucide-vue-next'
import { Rating } from '.'
{
render: () => ({
components: { Rating },
template: '<Rating :model-value="4" readonly />',
}),
}
MaxTen
import type { Meta, StoryObj } from '@storybook/vue3-vite'
import { ref } from 'vue'
import { Heart } from 'lucide-vue-next'
import { Rating } from '.'
{
name: 'Max Ten',
render: () => ({
components: { Rating },
setup() {
const value = ref(7)
return { value }
},
template: '<Rating v-model="value" :max="10" />',
}),
}