Get Variable from Component in View

How can I access the
$maxStars
variable in my view?

namespace App\Forms\Components;

use Filament\Forms\Components\Component;

class StarRating extends Component
{
    protected string $view = 'forms.components.star-rating';

    protected int $maxStars = 5;

    public static function make(): static
    {
        return app(static::class);
    }
}
Solution
Make it public variable and you can access it just by typinbg
{{ $maxStars }}
Was this page helpful?