adrema/app/View/Form/Label.php

33 lines
825 B
PHP

<?php
namespace App\View\Form;
use App\View\Traits\HasFormDimensions;
use App\View\Traits\RendersAlpine;
use Illuminate\View\Component;
class Label extends Component
{
use HasFormDimensions;
use RendersAlpine;
public function __construct(
public bool $required = false,
public string $value = ''
) {
}
public function render()
{
return <<<'HTML'
<span class="font-semibold leading-none text-gray-400 group-[.size-default]:text-sm group-[.size-sm]:text-xs">
<span x-text="{!! $asAlpineString($attributes, 'value') !!}"></span>
<template x-if="{!! $asAlpineBool($attributes, 'required') !!}">
<span class="text-red-800">&nbsp;*</span>
</template>
</span>
HTML;
}
}