<?php

namespace App\View\Form;

use App\View\Traits\HasFormDimensions;
use Illuminate\View\Component;

class Label extends Component
{

    use HasFormDimensions;

    public function __construct(
        public bool $required = false,
    ) {
    }

    public function render()
    {
        return <<<'HTML'
            <span class="font-semibold leading-none text-gray-400 group-[.size-default]:text-sm group-[.size-sm]:text-xs">
                {{ $slot }}
                @if ($required)
                <span class="text-red-800">&nbsp;*</span>
                @endif
            </span>
        HTML;
    }
}
