For the complete documentation index, see llms.txt. This page is also available as Markdown.

rating

Use the rating component to capture a score rating by selecting a number of icons, such as a 5 star rating.

Typical use cases include product reviews, service feedback, and surveys.

Rating component
Rating component

Configuration options

Some properties are common to all components, see Common component properties for a list and their configuration options.

Core structure
Description

instanceId

The unique identifier for the rating component.

icon

The icon used for each rating step (for example, a star). If omitted, the default rating-star icon is used.

label

Provide a label/name for the rating input. Label is displayed as a placeholder when no value is provided.

maximum

The maximum rating value. This typically controls how many icons are shown, for example, 5.

Other options
Description

align

The rating component's alignment within its container can be set to left, center, or right. The default is center. An expression can also be configured to set the alignment of the rating icons.

color

Sets the color of the rating's icons. Color conditions using the when property enable dynamic color options. First evaluated to be true will be used.

errorText

Add text, string, or expressions to show text under the rating indicating an error/invalid value in the field. ErrorText is shown in isNegative styling.

helperText

Add text, strings, or expressions to guide users by displaying text beneath the rating. HelperText is displayed only when there is no errorText property set.

initialValue

The value that the rating will load with when the screen initially loads. Use this to preset a default score.

isHidden

If true the rating will be hidden on the form. If set to false the field will be shown.

isIgnored

When true, the field will be ignored during data save, and the rating value will not be stored. This property is only applied when using the submit-form action.

isRequired

Set to true when the field is required, which is indicated by a grey asterisk. Set to false, the rating is optional.

style

The following property setting is available:

  • isDisabled - makes the rating field read-only.

value

The value to show for the rating. This is typically a numeric value representing the selected score. The value to show in the rating when the form initially loads. This can be combined with the isDisable style to preset the value that cannot be changed.

Actions
Description

onChange

The action is triggered when the value in the rating is changed. Use IntelliSense (ctrl+space) to see the list of available actions.

State Configuration
Key
Notes

=@ctx.component.state.

value

State is the variable of the component.

Considerations

  • The component is available for use in a jig.default, and in a card, section, expander, and view components as children.

  • If you want to display a rating inside a list item (instead of capturing input), use the rating property on a list-item.

Examples and code snippets

Basic rating

Basic rating component
Basic rating component

Basic example to rate the safety of a building site using component.rating in a default jig. The rating value is stored in component state: =@ctx.components.rating.state.value

Examples:

See the full example in GitHub.

Rating on a Form

In this example the rating component is used in a hotel feedback form to score guests overall experience. The icon, color and maximum number of icons are defined.

Examples:

See the full example in GitHub.

Rating on a form
Rating on a form

Rating with custom icon & colors

Rating with icons & color
Rating with icons & color

In this example, books are reviewed by selecting a book from the list. Selecting a book opens a modal containing a rating component configured with a custom icon, color, and number of icons. An input is used to pass the book title to the modal and display it as the title of the rating component.

When a rating is submitted, the selected value is saved to the corresponding book record in the database. The BookId is passed to the modal as an input and used by the action to identify which book record to update. Once the modal closes, the saved rating value is retrieved from the database and displayed using the list-item’s rating property.

Examples:

See the full example in GitHub.

Note: This example highlights the difference between the rating component, which captures a rating, and the list-item’s rating property, which is used only to display a rating on a list item.

Rating left aligned with helperText

In this example, the rating component is configured with custom icons that are left-aligned, along with a custom color, title, and helperText displayed beneath the icons.

Examples:

See the full example in GitHub.

Rating with helperText
Rating with helperText

Rating right aligned with initial value

Rating with initial value
Rating with initial value

In this example, the rating component is configured with custom right-aligned icons, a custom color and title, and an initialValue that is set when the screen opens. The rating can be updated by tapping the icons.

Examples:

See the full example in GitHub.

Dynamic rating with conditional icons & colors

This example demonstrates an advanced rating component that dynamically changes its appearance based on user interaction. Expressions are used in the icon and color properties to conditionally apply different icons and colors based on the number of icons selected by the user.

  1. When the component loads, no rating is selected

  2. As the user taps icons to select a rating (1-6):

    • The @ctx.component.state.value updates immediately.

    • The icon expression evaluates and switches between happy/confused emojis.

    • The color conditions evaluate and apply the appropriate theme color

  3. The user sees real-time visual feedback showing:

    • Low ratings (1-2): Red confused emoji

    • Medium rating (3): Yellow/orange confused emoji

    • High ratings (4-6): Green happy emoji

Examples:

See the full example in GitHub.

Rating icon & color set dynamically
Rating icon & color set dynamically

Rating in a card

Rating in a card component
Rating in a card component

In this example, a wilderness experience is scored using the rating component, which is configured inside a card component with custom icons and a title.

Examples:

See the full example in GitHub.

Last updated

Was this helpful?