| Name |
Type |
Default value |
Description |
|---|
| AllowClear |
bool |
false |
Lets the current value be cleared, by clicking the item that is already selected or by pressing Delete or Backspace. Clearing sets the value to 0, so it also makes 0 a reachable value the same way AllowZeroStars does. |
| AllowZeroStars |
bool |
false |
Allow the initial rating value be 0. Note that a value of 0 still won't be selectable by mouse or keyboard unless AllowClear is also set. |
| AriaLabelFormat |
string? |
null |
Optional label format for each individual rating star (not the rating control as a whole) that will be read by screen readers. Placeholder {0} is the current rating and placeholder {1} is the max. Without it an item is named by its ItemTitles tooltip, and failing that by its position in the scale. |
| AutoFocus |
bool |
false |
If true, the rating automatically receives focus when the page renders. |
| Classes |
BitRatingClassStyles? |
null |
Custom CSS classes for different parts of the BitRating. |
| Color |
BitColor? |
null |
The general color of the rating, applied to the filled part of the items. The unfilled part stays neutral so it reads as "not rated yet" whichever color is picked. |
| GetAriaLabel |
Func<double, double, string>? |
null |
Optional callback to set the aria-label for rating control in readOnly mode. Also used as a fallback aria-label if the AriaLabel parameter is not provided. The first argument is the current value and the second one is the max. |
| GetSelectedIcon |
Func<int, BitIconInfo?>? |
null |
Chooses the selected (filled) icon of each rating item separately, from the one-based position of the item. Returning null falls back to SelectedIcon / SelectedIconName. |
| GetUnselectedIcon |
Func<int, BitIconInfo?>? |
null |
Chooses the unselected (empty) icon of each rating item separately, from the one-based position of the item. Returning null falls back to UnselectedIcon / UnselectedIconName. |
| HighlightSelectedOnly |
bool |
false |
Highlights only the item matching the current value instead of every item up to it, turning the rating into a scale of standalone choices rather than a cumulative one. A fractional value still fills its own item by the fraction it covers. |
| ItemTemplate |
RenderFragment<BitRatingItemContext>? |
null |
Replaces the default pair of icons of every rating item with custom content. |
| ItemTitles |
IList<string>? |
null |
The native tooltips of the rating items, in order, shown when hovering over each one, and used as the accessible name of the item unless AriaLabelFormat overrides it. Items beyond the end of the list simply get no tooltip. |
| Max |
int |
5 |
Maximum rating, which is also the number of rendered items. Values below 1 are treated as 1. |
| NoHoverPreview |
bool |
false |
Turns off the preview that follows the pointer over the items and shows the value that a click would commit. |
| OnChanging |
EventCallback<BitRatingChangeArgs> |
|
Callback invoked before the value of the rating changes, letting the change be cancelled by setting Cancel on the provided args. |
| OnHoverChange |
EventCallback<double?> |
|
Callback for when the previewed value changes, which is the value a click would commit. It receives null when the pointer leaves the rating and the preview ends. |
| Precision |
double |
1 |
The smallest change of the value the user can make, as a fraction of a single item. The default of 1 only allows whole items, 0.5 adds halves, 0.1 makes every tenth selectable. It constrains what the user can pick, not what can be displayed. |
| SelectedIcon |
BitIconInfo? |
null |
Icon for selected rating elements using external icon libraries (e.g. FontAwesome, Bootstrap Icons). Takes precedence over SelectedIconName when both are set. |
| SelectedIconName |
string? |
FavoriteStarFill |
Custom icon name for selected rating elements (Fluent UI). For external icon libraries, use SelectedIcon instead. |
| Size |
BitSize? |
null |
Size of rating elements. |
| Styles |
BitRatingClassStyles? |
null |
Custom CSS styles for different parts of the BitRating. |
| UnselectedIcon |
BitIconInfo? |
null |
Icon for unselected rating elements using external icon libraries (e.g. FontAwesome, Bootstrap Icons). Takes precedence over UnselectedIconName when both are set. |
| UnselectedIconName |
string? |
FavoriteStar |
Custom icon name for unselected rating elements (Fluent UI). For external icon libraries, use UnselectedIcon instead. |
| ValueTextFormat |
string? |
null |
The format of the spoken form of the current value, where placeholder {0} is the value and placeholder {1} is the max. It is what the live region of an interactive rating announces for a value no radio can carry, and what a read-only rating falls back to when it is given no other label. The default is "{0} of {1}". |
| Vertical |
bool |
false |
Stacks the rating items in a column instead of a row, filling from the bottom up so that "more" is up, the way the ArrowUp key means more. |
| Name |
Type |
Default value |
Description |
|---|
| DefaultValue |
TValue? |
null |
The default value of the input to be used in uncontrolled mode (i.e. when the Value is not bound), typically used alongside the OnChange callback. |
| DisplayName |
string? |
null |
Gets or sets the display name for this field. |
| InputHtmlAttributes |
IReadOnlyDictionary<string, object>? |
null |
Gets or sets a collection of additional attributes that will be applied to the created element. |
| Name |
string? |
null |
Gets or sets the name of the element. Allows access by name from the associated form. |
| NoValidate |
bool |
false |
Disables the validation of the input. |
| OnChange |
EventCallback<TValue?> |
|
Callback for when the input value changes. |
| ReadOnly |
bool |
false |
Makes the input read-only. |
| Required |
bool |
false |
Makes the input required. |
| Value |
TValue? |
null |
Gets or sets the value of the input. This should be used with two-way binding. |
| Name |
Type |
Default value |
Description |
|---|
| AriaLabel |
string? |
null |
Gets or sets the accessible label for the component, used by assistive technologies. |
| Class |
string? |
null |
Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir |
BitDir? |
null |
Gets or sets the text directionality for the component's content. |
| ForceAnimation |
bool |
false |
Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes |
Dictionary<string, object> |
new Dictionary<string, object>() |
Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. |
| Id |
string? |
null |
Gets or sets the unique identifier for the component's root element. |
| IsEnabled |
bool |
true |
Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| Style |
string? |
null |
Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex |
string? |
null |
Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility |
BitVisibility |
BitVisibility.Visible |
Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
BitRatingItemContext properties
The context passed to the ItemTemplate, describing the rating item being rendered.
| Name |
Type |
Default value |
Description |
|---|
| Index |
int |
|
The one-based position of the item in the rating. |
| Max |
int |
|
The number of items the rating renders. |
| Percentage |
double |
|
How much of the item is filled, from 0 to 100. A partially filled item is the fractional part of the value. |
| DisplayValue |
double |
|
The value the item is rendered from, which is the hovered value while a hover preview is active, and the committed value otherwise. |
| Value |
double |
|
The committed value of the rating, regardless of any hover preview. |
| IsSelected |
bool |
|
Whether the item is filled at all, meaning its Percentage is greater than zero. |
| IsFull |
bool |
|
Whether the item is completely filled, meaning its Percentage is 100. |
BitIconInfo properties
Represents icon information for rendering icons. Supports built-in Fluent UI icons and external icon libraries (FontAwesome, Bootstrap Icons, etc.). Use BitIconInfo.Css("fa-solid fa-star"), BitIconInfo.Fa("solid star"), or BitIconInfo.Bi("star-fill") for external icons.
| Name |
Type |
Default value |
Description |
|---|
| Name |
string? |
null |
Gets or sets the name of the icon. |
| BaseClass |
string? |
null |
Gets or sets the base CSS class for the icon. For external icon libraries like FontAwesome, you might set this to "fa" or leave empty. |
| Prefix |
string? |
null |
Gets or sets the CSS class prefix used before the icon name. For external icon libraries, you might set this to "fa-" or leave empty. |