'boolean',
];
protected string $hint = '';
protected bool $isChecked = false;
#[Override]
public function render(): string
{
$this->mergeClass('relative justify-between inline-flex items-center gap-x-2');
$checkbox = form_checkbox(
[
'id' => $this->id,
'name' => $this->name,
'class' => 'form-switch',
],
'yes',
old($this->name) ? old($this->name) === 'yes' : $this->isChecked
);
$hint = $this->hint === '' ? '' : (new Hint([
'class' => 'ml-1',
'slot' => $this->hint,
]))->render();
return <<getStringifiedAttributes()}>
{$this->slot}{$hint}
{$checkbox}
HTML;
}
}