Skip to main content

Rating

Rocket 2.0

The Rating component lets the user give a score by clicking a row of icons, such as stars for a review, a satisfaction score or a priority level. It can also display a rating without letting the user change it.

Properties​

Property
Description
Expected Value
LabelText shown above the icons.Text. Default: Rating
Help textHint text shown under the icons.Text
Default valueRating shown when the app loads.Number. Default: 4
Number of icons (1 to 10)Number of icons in the row, from 1 to 10. This is the highest possible rating.Number. Default: 5
IconShape of the icons.Star, Heart, Circle. Default: Star
SizeSize of the icons.Small, Medium, Large. Default: Medium
Allow half valuesLets the user pick half values, such as 3.5, by clicking the left half of an icon.On or off. Default: Off
Click the current value to clearClears the rating to 0 when the user clicks the icon of the current rating again.On or off. Default: On
Read onlyShows the rating without letting the user change it.On or off. Default: Off
Show value textShows the rating as text next to the icons, such as 4 / 5, or the matching entry from Value labels.On or off. Default: Off
Value labels (one per icon)A word for each rating, one per icon, such as ['Poor', 'Fair', 'Good', 'Great', 'Excellent']. Shown as the value text and read out by screen readers.Array

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On changeTriggers when the user changes the rating.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set valueSets the rating to the given Value.components.rating1.setValue("")
ClearClears the rating to 0.components.rating1.clear()
Reset valueSets the rating back to Default value.components.rating1.resetValue()
Set visibilityShows the component when true, hides it when false.components.rating1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.rating1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.rating1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the icons.{{components.rating1.label}}
descriptionHint text shown under the icons.{{components.rating1.description}}
defaultValueRating shown when the app loads.{{components.rating1.defaultValue}}
maxNumber of icons in the row, from 1 to 10. This is the highest possible rating.{{components.rating1.max}}
iconShape of the icons.{{components.rating1.icon}}
sizeSize of the icons.{{components.rating1.size}}
allowHalfLets the user pick half values, such as 3.5, by clicking the left half of an icon.{{components.rating1.allowHalf}}
allowClearClears the rating to 0 when the user clicks the icon of the current rating again.{{components.rating1.allowClear}}
readOnlyShows the rating without letting the user change it.{{components.rating1.readOnly}}
showValueShows the rating as text next to the icons, such as 4 / 5, or the matching entry from Value labels.{{components.rating1.showValue}}
valueLabelsA word for each rating, one per icon, such as ['Poor', 'Fair', 'Good', 'Great', 'Excellent']. Shown as the value text and read out by screen readers.{{components.rating1.valueLabels}}
valueThe current rating, or 0 when there is none.{{components.rating1.value}}
isVisibleWhether the component is visible.{{components.rating1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.rating1.isLoading}}
isDisabledWhether the component is disabled.{{components.rating1.isDisabled}}

Styles​

Style
Default
Filled icon color#f59e0b
Empty icon colorTheme: Placeholder text
Value text colorTheme: Placeholder text
Label colorTheme: Primary text
Help text colorTheme: Placeholder text
Focus ring colorTheme: Brand primary
Error colorTheme: Error
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.