Props
| Name | Description |
|---|---|
autofocus Type: Booleanish | Focuses the field when it mounts (a dialog already open included), unless the user is typing in another field. |
clearable Type: booleanDefaultfalse | Allows clearing the selected rating by clicking the current value. Adds the only way back to unrated, since a radio group cannot be un-picked: click the selected star again, or press Delete or Backspace on it. Neither gesture is discoverable, so pair it with a hint, and expect |
compact Type: booleanDefaultfalse | Compact density. Swaps |
description Type: string | Text between the label and the input. Unlike the hint it is always visible; it joins the input's Always visible, above the stars. The place for what the scale means before anyone picks a point on it. See example |
disabled Type: booleanDefaultfalse | Disables the component. Takes the group out of the tab order, so the score is missing entirely for someone navigating by keyboard. Prefer |
errors Type: string | string[] | Error messages under the field, a string or array, in an Applies to the whole fieldset rather than to one star. Inside a |
formless Type: booleanDefaultfalse | Keep this control out of the enclosing |
hasErrors Type: booleanDefaultfalse | Define if the component should be in an error state. It usually attaches a CSS class for styling purposes. |
hasWarnings Type: booleanDefaultfalse | Define if the component should be in a warning state. Same chrome as errors with |
hideLegend Type: booleanDefaultfalse | Visually hides the legend of the fieldset while maintaining accessibility. Keeps the accessible name and removes only the visible text, which is what a score under a product title wants. |
hint Type: string | Text box to be displayed near the input, usually to indicate instructions. |
id Type: string | Prefix for the ids of each option's input and of the label, description and message. Generated when omitted. |
inputAlign Type: FieldCrossAlign | Vertical position of the control in a side-by-side row; not |
inputPosition Type: "left" | "center" | "right"Default"left" | Sets the alignment of the input. Since inputs are inline block they can be aligned just as text can. Aligns the row of stars within its column. It was accepted, typed and documented in v2 and did nothing: the rules targeted a class this component never rendered. v3 repoints them, so a hand-rolled alignment workaround now fights the library and should be deleted. |
labelAlign Type: FieldCrossAlign | Vertical position of the label block in a side-by-side row; not |
layout Type: Responsive<FieldLayout> | How label and input sit together: |
legend requiredType: string | Text content of the legend. The family says |
legendMode Type: "outside" | "inside" | Legend rendering mode. Places the legend the way |
legendPosition Type: "left" | "center" | "right" | Sets the text alignment of the legend. |
modelValue Type: number | null | Used by v-model. |
name Type: string | Name of the star radio inputs. Optional: the stars live in one component instance, so an omitted name falls back to a generated one that groups them correctly. Pass one only when a native (non-JS) form post must submit the value under a known key. The key of the value inside a |
persistentHint Type: booleanDefaultfalse | Keeps the hint displayed. |
pt Type: PtMap<BbRatingPtPart, BbRatingPtState> | Passthrough, object form: the same keys as the |
pt:<part> Type: PtValue | Passthrough, attribute form: one attribute per part, |
readonly Type: booleanDefaultfalse | Sets the input in a readonly state. Keeps the group focusable and exposes |
required Type: booleanDefaultfalse | Sets the input as required. Applies to the fieldset, so any star satisfies it, and marks the legend unless the plugin's |
reverse Type: booleanDefaultfalse | Reverses the layout. Applicable in every direction the order of the label and the input is swapped. |
rules Type: RuleExpression<number | null> | vee-validate rules for this field. Only inside a Inside a |
size Type: number | CssSize | keyof SizesDefault'md' | Defines the component size.
Accepted values:
- A key from the provided size map ( The glyph size only — never the number of stars and never the value, both of which are |
stars Type: numberDefault5 | Maximum number of stars to render and maximum value of the component. Sets the number of glyphs and the maximum value at once. Past ten or so a row of identical glyphs stops being countable at a glance; a |
validationLabel Type: string | The field's name in validation messages ( |
validationMode Type: ValidationMode | When the field validates: |
warnings Type: string | string[] | Warning messages under the field, a string or array: amber, in their own The amber counterpart of |
v-model
Values kept in sync through v-model.
| Name | Description |
|---|---|
modelValue Type: number | null |
|
Events
| Name | Description |
|---|---|
active Type: (): void | Emitted when the rating becomes active (focus/click enters it). |
blur Type: (event: FocusEvent): void | Emitted when a star input loses focus. Forwards the original DOM |
change Type: (event: Event): void | Emitted when the selected rating changes. Forwards the original DOM |
click Type: (event: MouseEvent): void | Emitted when a star input receives a click. Forwards the original DOM |
focus Type: (event: FocusEvent): void | Emitted when a star input gains focus. Forwards the original DOM |
inactive Type: (): void | Emitted when focus/click moves outside the rating after it was active. |
input Type: (event: Event): void | Emitted on native input events from the star inputs. Forwards the original DOM |
keydown Type: (event: KeyboardEvent): void | Emitted for keyboard interaction on a star input. Forwards the original DOM |
mousedown Type: (event: MouseEvent): void | Emitted when a pointing device button is pressed over a star input. Forwards the original DOM |
mouseup Type: (event: MouseEvent): void | Emitted when a pointing device button is released over a star input. Forwards the original DOM |
update:modelValue Type: (value: number | null): void | Emitted with the selected rating (1 to |
Slots
The listed properties are the ones exposed to the slot scope.
| Name | Description |
|---|---|
append Type: object | Content rendered after the row of rating stars. Where the precise figure and the sample size go, because there are no half stars: a 4.6 average fills four, so round for the glyphs and print the decimal as text. See example |
description Type: BbRatingDescriptionSlotProps | Replaces the description text. Provided alone (no |
icon Type: BbRatingIconSlotProps | Replaces the default star SVG for each rating option. Replaces the star icon and nothing else. |
legend Type: BbRatingLegendSlotProps | Replaces the default fieldset legend text rendered above the rating stars. |
prepend Type: object | Content rendered before the row of rating stars. |
Renamed and removed
Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.
colorremovedfails silentlydirectionlayoutfails silentlyhasWarninghasWarningsfails silentlyvalidateOnvalidationModefails silentlyAn array of events became one mode (
aggressive|balanced|lazy|submit-only|submit-live). The old defaults (['blur'],['inactive'], a toggle's['update:modelValue', 'change', 'blur']) arebalanced, the new default: delete the prop. A text field on['update:modelValue']isvalidation-mode="aggressive". Set it once on<BbForm validation-mode>instead of per field.vidremovedfails silentlyA display name (v2:
vid="Email address") is nowvalidation-label; a field path (3.0 betas:vid="address.city") is nowname(brackets for a native post:address[city]).check --fixpicks by the value.