Fields
Rating
Star rating field with configurable max stars, half-star precision, and colour.
Star rating field with configurable max stars, half-star precision, and colour.
use NyonCode\WireForms\Components\Rating;
Basic Usage
Rating::make('score') ->max(5) ->default(0)
Half Stars
Rating::make('rating') ->allowHalf() // allows 0.5 increments: 1, 1.5, 2, 2.5 …
Custom Max
Rating::make('priority') ->max(3) // 3-star scale
Colours
Rating::make('satisfaction') ->color('primary') // primary, success, danger, warning (default)
Non-Clearable
Rating::make('score') ->clearable(false) // clicking the active star no longer resets it
Methods
| Method | Type | Description |
|---|---|---|
max(int) |
int | Number of stars (default 5) |
allowHalf(bool) |
bool | Enable half-star selection (default false) |
color(string) |
string | Filled-star colour: warning, primary, success, danger |
clearable(bool) |
bool | Click active star to reset to 0 (default true) |
default(int|float|Closure) |
number | Pre-filled value |
disabled(bool|Closure) |
bool | Disable the rating |
required() |
— | Mark as required |
live() |
— | Trigger Livewire update on click |
See Common Field API for label, hint, tooltip, and other shared methods.