Skip to content

Rating - Web Component

The Rating component can be used imported from:

Playground

Parameters

The Web component uses the <z-rating> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlotA11y
valuenumberThe current score of the rating. It can be a number between 0 and 5.
readonlybooleanIf `true`, the rating will be displayed as a score.
disabledbooleanBlocks the interaction with the input component.
show-scorebooleanIf `true`, the rating will be displayed with a score.

Events

This component has events. Check the documentation about how to use the events.

NamePayloadDescription
changenumberReturns the new value of the "value" attribute
restartedvoidEmitted on value reset

Slots

This component has slots. Check the documentation about how to use the slots.

NameTagsDescription

Parameters use

value

The value parameter is used to set the value of the rating.

readonly

The readonly parameter is used to set the rating in a read-only state.

disabled

The disabled parameter is used to block the interaction with the component.

show-score

The show-score parameter is used to display the score of the rating.

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

HTML Examples

CodeSandbox example