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: click the selected star, or Space on it. Adds the only way back to unrated, since a radio group cannot be un-picked: click the selected star again, or press Space on it (Delete and Backspace do nothing). Neither gesture is discoverable, so pair it with a hint, and expect |
compact Type: boolean | 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: "end" | "start" | "center" | "left" | "right"Default'start' | Alignment of the input in its column. 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: "end" | "start" | "center" | "left" | "right"Default'start' | Text alignment of the legend. |
modelValue Type: number | null | Used by v-model. A user picks whole stars; a |
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: (PtCompoundOf<"", { readonly parts: readonly ["root", "legend", "description", "message", "hint", "item"]; readonly states: readonly ["hasValue", "selected", "readonly", "disabled", "warnings", "errors"]; readonly wide: readonly ["hasValue", "readonly", "disabled", "warnings", "errors"]; readonly node: { readonly item: readonly ["selected"]; }; }> & { legend?: PtValue | undefined; root?: PtValue | undefined; "root:disabled"?: PtValue | undefined; "root:errors"?: PtValue | undefined; "root:warnings"?: PtValue | undefined; "root:readonly"?: PtValue | undefined; item?: PtValue | undefined; "item:disabled"?: PtValue | undefined; "item:selected"?: PtValue | undefined; description?: PtValue | undefined; message?: PtValue | undefined; hint?: PtValue | undefined; "description:disabled"?: PtValue | undefined; "description:errors"?: PtValue | undefined; "description:warnings"?: PtValue | undefined; "description:readonly"?: PtValue | undefined; "message:disabled"?: PtValue | undefined; "message:errors"?: PtValue | undefined; "message:warnings"?: PtValue | undefined; "message:readonly"?: PtValue | undefined; "hint:disabled"?: PtValue | undefined; "hint:errors"?: PtValue | undefined; "hint:warnings"?: PtValue | undefined; "hint:readonly"?: PtValue | undefined; "legend:disabled"?: PtValue | undefined; "legend:errors"?: PtValue | undefined; "legend:warnings"?: PtValue | undefined; "legend:readonly"?: PtValue | undefined; "legend:hasValue"?: PtValue | undefined; "root:hasValue"?: PtValue | undefined; "item:errors"?: PtValue | undefined; "item:warnings"?: PtValue | undefined; "item:readonly"?: PtValue | undefined; "item:hasValue"?: PtValue | undefined; "description:hasValue"?: PtValue | undefined; "message:hasValue"?: PtValue | undefined; "hint:hasValue"?: PtValue | undefined; }) | 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: boolean | 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: (value: number | null): void | Emitted when the rating becomes active (focus/click enters it), with the current value. |
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: (value: number | null): void | Emitted when focus/click moves outside the rating after it was active, with the current value, whether or not it changed. |
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 |
value-commit Type: (value: number | null): void | Emitted once the user finishes changing the value, after The hook for saving: each pick, arrow keys included, and clear. Never for a value your code sets. See example |
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 figure and the sample size go. Pass a read-only average as it is: |
description Type: BbRatingDescriptionSlotProps | Replaces the description text. Provided alone (no |
hint Type: BbRatingDescriptionSlotProps | Replaces the hint text; alone it still renders the row. May hold an action. |
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 silentlypt:labelpt:legendfails 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.