RatingField

Form & Input
stable

Star-rating input with configurable length, half-increment support, hover preview and clearable option.

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamRatingFieldSchematic of the RatingField component with 5 numbered parts. Rating label ★★★★☆ × 1 2 3 4 5
Anatomy of <origam-rating-field> — 5 parts: root ①, label ②, star wrapper ③, individual star item ④, and clear button ⑤.
1.origam-rating-field
Root element. Inline-flex container. Wraps OrigamInput for label/messages.
2.origam-rating-field__label
Label zone rendered via OrigamLabel. Visible when label prop is set.
3.origam-rating-field__wrapper
Per-star-position wrapper. Hosts optional itemLabel above/below the star.
4.origam-rating-field__content
Inner row hosting one or two OrigamRatingFieldItem per position (two when halfIncrements=true).
5.origam-rating-field__clear
Clear button (OrigamBtn icon). Visible when clearable=true and modelValue > 0.

API

Props

All props accepted by this component, with their type, default value and description.

name
string
Name used for the radio inputs in the star row. Auto-generated if not provided.
label
string
Label rendered above the star row via OrigamLabel.
itemAriaLabel
string
Aria-label template for each star item. Interpolated with the item value.
clearable
boolean
false
Shows a clear button when the current value > 0 and the field is not disabled or readonly.
disabled
boolean
false
Disables all interaction. Hides the clear button and prevents click/hover events.
emptyIcon
MDI icon used for unfilled stars. Defaults to mdi-star-outline.
fullIcon
MDI icon used for filled (selected) stars. Defaults to mdi-star.
halfIncrements
boolean
false
Allows selection of half-star values (0.5, 1.5, 2.5…). Renders two items per star position.
hover
boolean
false
Enables hover preview: hovering a star highlights all stars up to that position.
length
number | string
5
Total number of rating items (stars). Default is 5.
readonly
boolean
false
Makes the field read-only (pointer-events: none). Useful for display-only ratings.
modelValue
number | string
0
Current rating value. Bound with v-model. Clamped to [0, length].
itemLabels
Array<string>
Text labels displayed above or below each star position.
itemLabelPosition
'top'
Position of item labels: 'top' (above the star row) or 'bottom' (below).
centerAffix
boolean
hideDetails
boolean | string
hideSpinButtons
boolean
hint
string
persistentHint
boolean
messages
Array<string> | string
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
density
'default'
Adjusts the density of the Input wrapper.
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
rounded
boolean | number | string | TRounded | null | undefined
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
color
TColor
bgColor
TColor
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
elevation
TElevation
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
direction
TDirection
error
string | boolean
errorMessages
Array<string> | string
maxErrors
number | string
rules
Array<any>
validateOn
TValidateOn
validationValue
any
focused
boolean
appendAvatar
string
appendIcon
TIcon
prependAvatar
string
prependIcon
TIcon
prependAriaLabel
string
appendAriaLabel
string
size
'default'
Controls the size of each star icon.
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
ripple
boolean | { class: string }
true
Enables ripple effect on each star item.
tag
string
'div'
Root HTML tag. Defaults to div.
text
string
floating
boolean
required
boolean
false
Marks the field as required.
letterSpacing
TLetterSpacing

API

Slots

Content slots exposed by this component.

#default
Replaces the entire inner layout (label + star row). Receives input context.
#label
Custom label content replacing the default OrigamLabel.
#itemLabel
Custom label content for each star position. Also supports per-index slot `itemLabel.{index}`.
#details
#messages
Custom messages/errors area below the star row.
#message
#prepend
Content prepended before the rating row.
#append
Content appended after the rating row.

API

Emits

Events emitted by this component.

@update:modelValue
any
Emitted when the user clicks a star. Carries the new numeric rating value.

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to sub-components.
Ref<string>
Reactive CSS string generated by useStyle.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet. Called automatically on mount.
() => void
Removes the injected style sheet. Called automatically on unmount.
Ref<boolean>
True once the style sheet has been injected.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Gap between star items.
Transition duration for star fill animations.
Color of unfilled star items.
Color of filled (selected) star items.
Icon size for each star item.
Transform scale applied to a star on hover.
Opacity of the entire field when disabled.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

ARIA roles

radiogroup
radio

Keyboard interactions

Keyboard interactions
KeyAction
TabMoves focus to the first or next star item.
Arrow Left / RightNavigates between star positions.
SpaceSelects the focused star value.

Notes

  • Each star item renders a native <input type="radio">. Screen readers announce position and total (e.g. "3 of 5").
  • When readonly=true, pointer-events are disabled. The read-only class is applied to the root.
  • itemAriaLabel provides a custom aria-label template for each star, replacing the default numeric label.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Basic usage

vue

Hover preview & half increments

vue

Custom icons

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.