Number

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Extends Text * has the same features

Input with the number type and additional methods: stars, min, max

use MoonShine\Fields\Number;
 
//...
public function fields(): array
{
return [
Number::make('Rating', 'rating')
->min(1)
->max(5)
];
}
 
//...

To display a numerical value as stars (e.g. for rating), you need the stars method

use MoonShine\Fields\Number;
 
//...
public function fields(): array
{
return [
Number::make('Rating', 'rating')
->stars()
->min(1)
->max(5)
];
}
 
//...