Rating
Star-based rating component. Supports read-only display, interactive editing, half-star increments, and keyboard navigation.
Read-Only
Interactive
Sizes
Custom Colour
Click a star to rate...
PHP PHP Methods (Fluent)
| Method / Property | Parameters | Description |
|---|
$m->rating($id) | string | Create a rating component. |
->value($v) | float | Initial rating value. |
->max($m) | int | Number of stars (default: 5). |
->readonly($ro) | bool | Make display-only (default: false). |
->halfStars($half) | bool | Enable half-star rendering (default: false). |
->label($text) | string | Label text beside the stars. |
->size($s) | string | Size: sm, md, lg. |
->sm() | | Small size shorthand. |
->lg() | | Large size shorthand. |
->color($c) | string | Colour: primary, warning, danger, success, purple. |
->onChange($callback) | string | JS function name or expression called with (value, element). |
JS JS Methods
| Method / Property | Parameters | Description |
|---|
m.rating(id, overrides) | string, ?object | Get or create rating instance. |
getValue() | | Returns the current rating value. |
setValue(value) | number | Set the rating value. |
destroy() | | Clean up event listeners. |
EVENT Events
| Event Name | Detail | Description |
|---|
m-rating-change | {value} | Fired when the rating value changes (interactive mode). |