Rate
The wje-rate is used to both enter and display the rating. The component supports integer and decimal steps, readonly mode, disabled state and custom icons.
Basic use
The simplest scenario is an interactive rating with default stars and a maximum according to the max attribute.
Default value
The value attribute sets the initial or current value of the evaluation. It is useful when editing an existing rating as well as for read-only views.
Accuracy of assessment
If you need halves or other smaller increments, use the precision attribute. The resulting hover and click behavior is then rounded according to the set precision.
Read-only mode
With readonly, the value remains visible, but the user can no longer change it. This is useful, for example, when displaying an already saved evaluation.
Disabled status
Disabled state blocks both interaction and hover feedback. Use it where the rating is temporarily unavailable or pending another condition.
When to use
Use wje-rate when the user rates quality, satisfaction or preference on a small scale.
When not to use
Do not use it where precise numerical input is required or where the scale has no clear meaning to the user.
Accessibility
For important decisions, supplement the assessment with textual context so that the user understands both the scale and the actual value. Readonly and disabled status should be understandable even without hover.
Recommended practices
- Keep the meaning of the scale consistent, such as 1 to 5, across the entire application.
- If you use custom icons via
icons, keep the same visual logic for both filled and unfilled state. - When displaying a saved rating, consider readonly mode instead of disabled if the value is still to be easily readable.
Attributes and properties
disabled
| Popis | Vypína používateľskú interakciu s komponentom. |
| Atribút | disabled |
| Typ | boolean |
| Predvolené | - |
icons
| Popis | Prepíše názvy ikon vykreslených pre jednotlivé kroky hodnotenia. |
| Atribút | icons |
| Typ | Array<string> |
| Predvolené | [star] |
max
| Popis | Nastavuje maximálny počet krokov hodnotenia vykreslených komponentom. |
| Atribút | max |
| Typ | number |
| Predvolené | - |
precision
| Popis | Nastavuje krok, po ktorom sa dá vyberať aj desatinné hodnotenie. |
| Atribút | precision |
| Typ | number |
| Predvolené | 1 |
readonly
| Popis | Zabráni používateľovi upravovať hodnotu. |
| Atribút | readonly |
| Typ | boolean |
| Predvolené | - |
value
| Popis | Nastavuje aktuálnu hodnotu hodnotenia. |
| Atribút | value |
| Typ | number |
| Predvolené | 0 |
Events
Pre tento komponent nie sú dostupné žiadne udalosti.
Methods
Pre tento komponent nie sú dostupné žiadne verejné metódy.
CSS shadow parts
| Názov | Popis |
|---|---|
native | Štýluje koreňovú shadow časť komponentu. |
CSS custom variables
| Názov | Popis |
|---|---|
--wje-rate-gap | Vlastná CSS premenná, ktorá riadi gap. |
--wje-rate-color | Vlastná CSS premenná, ktorá riadi color. |
--wje-rate-selected-color | Vlastná CSS premenná, ktorá riadi selected color. |
Slots
Pre tento komponent nie sú dostupné žiadne sloty.