RatingFieldItem

Form & Input
stable

Individual star item in a RatingField. Renders an icon-only Btn in text variant that handles filled/hovered/half-increment state and a visually-hidden radio input.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamRatingFieldItemSchematic of the RatingFieldItem component with 4 numbered internal parts. label ★ hidden radio input 1 2 3 4
Anatomy of <origam-rating-field-item> — 4 parts. Root ① wraps the visually-hidden accessible label ② and the star Btn ③ (with fullIcon/emptyIcon). A hidden radio input ④ tracks the selection state for screen readers and form submission.
1.origam-rating-field-item
Root element (div by default). Applies --half / --full modifier classes when halfIncrements is active.
2.origam-rating-field-item__hidden (label)
Visually-hidden inside a
3.origam-btn (variant="text" icon)
Inner OrigamBtn rendered in variant="text" icon mode. Displays fullIcon or emptyIcon depending on filled/hovered state. The #item slot overrides this.
4.origam-rating-field-item__hidden (input)
Visually-hidden native (tabindex="-1"). Tracks checked state for form participation and screen reader state. Not focusable — keyboard navigation uses the Btn.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

name
string
Name attribute used to build the id of the hidden radio input (id = "{name}-{value}").
index
number
-1
Zero-based position of this item in the parent RatingField.
value
requis
number
—
Numeric value this star represents (e.g. 1, 1.5, 2, …). Required.
label
string
Accessible label for this star. Falls back to the itemAriaLabel locale key.
itemAriaLabel
string
showStar
boolean
true
When false, the OrigamBtn icon is hidden (half-increment placeholder).
isFilled
boolean
false
True when this star is within the current rating value (shows fullIcon).
isHovered
boolean
false
True when the cursor is over this star or a later star (triggers hover preview).
isHovering
boolean
false
True when the parent RatingField is in a hover state. Controls whether isFilled or isHovered drives the icon selection.
disabled
boolean
false
Disables the star button and the hidden radio input.
readonly
boolean
false
Makes the star non-interactive without disabling it visually.
fullIcon
'mdi-star'
MDI icon shown when the star is filled (isFilled=true or isHovered=true).
emptyIcon
'mdi-star-outline'
MDI icon shown when the star is empty.
halfIncrements
boolean
false
Enables half-star rendering. When true, items with fractional values apply clip-path to show only half the star.
checked
boolean
false
Checked state of the underlying hidden radio input.
length
number | string
Total number of stars in the parent RatingField. Used to build the accessible label.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
Root HTML element rendered by the component.
color
Icon color. Overrides the default star fill color from the rating-field token.
density
Density passed down from the parent RatingField.
ripple
boolean | { class: string }
true
Enables the Material ripple on the star button.
Size of the inner Btn / icon. Propagated from the parent RatingField.
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
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
elevation
TElevation

API

Slots

Emplacements de contenu exposés par ce composant.

#item
Replaces the default OrigamBtn star with a custom element. Receives all computed btn props and the numeric value.

API

Emits

Événements émis par ce composant.

@mouseenter
MouseEvent
Fired when the pointer enters this star. Used by the parent to drive hover preview.
@mouseleave
MouseEvent
Fired when the pointer leaves this star. Used by the parent to clear hover preview.
@change
Event
@keydown
KeyboardEvent
@click
MouseEvent
Fired when the star button is clicked. Forwarded from the inner OrigamBtn.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to child components.
Ref<string>
Reactive CSS string generated by useStyle.
ComputedRef<string>
Computed id of the hidden radio input ("{name}-{value}").
() => 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.
string
Unique style-sheet ID for this instance.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

Default (empty) star color.
Star color when filled or hovered.
Star color when disabled.
Icon size of each star.
Scale applied to the star on hover.
Transition duration for scale and color animations.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

radio

Interactions clavier

Interactions clavier
ToucheAction
TabFocuses the star button. The hidden radio input is tabindex="-1" and not directly reachable by Tab.
Space / EnterActivates the star button, emitting click and setting the parent RatingField value.

Notes

  • The hidden radio input is always present but tabindex="-1". It participates in form submission and screen-reader state announcements without entering the normal keyboard focus order.
  • The accessible label (aria text) is built from the itemAriaLabel locale key via t(itemAriaLabel, value, length). It reads "Rate N of M stars" for screen readers.
  • In half-increment mode, items with value % 1 > 0 use clip-path to show half a star. Both the full and half items render a separate label/input pair so the underlying model remains accessible.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Standalone (internal usage)

vue

Custom item slot via RatingField

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.