Skip to content

Rating

Rating renders NaviusRating, the headless primitive that owns the APG radio-group keyboard contract (role="radiogroup", roving tabindex), and layers a star glyph per item on top: each NaviusRatingItem gets a muted base star plus a primary-fill overlay clipped by data-state (full/half/empty), so both whole and half values (AllowHalf) render correctly. The wrapper owns its own controlled/uncontrolled value mirror, forwarding Value to the primitive only when the consumer actually set it (the always-controlled wart fix), so the uncontrolled DefaultValue path stays live.

Terminal window
navius add rating --to ./src/MyApp --namespace MyApp.Ui
@using Zits.Ui.Components
<ZitsRating @bind-Value="_value" AllowHalf="true" />
@code {
private decimal? _value;
}

Rating is a single control with no separate part tree; each star is generated internally from Max. Max, AllowHalf, AllowClear, ReadOnly, Disabled, Required, Invalid, Name, Label, and Dir pass through to NaviusRating unchanged. The styled wrapper adds:

Prop Type Default Description
Value decimal? null (unrated) Controlled value. Bind with @bind-Value; forwarded to the primitive only when set.
DefaultValue decimal? null Uncontrolled initial value.

Attributes on ZitsRating is merged onto the root NaviusRating via Cn.Merge, with the caller’s classes applied last. Individual star classes are internal to the composition and not independently overridable per-instance.

Part Attribute Description
Root data-disabled Present when Disabled is true, emitted by NaviusRating.
Item data-state full | half | empty, emitted by NaviusRatingItem; drives the fill-overlay width.
Item data-readonly Present when ReadOnly is true, emitted by NaviusRatingItem; suppresses the hover scale.