'boolean',
];
/**
* @var 'base'|'small
*/
protected string $size = 'base';
protected string $hint = '';
protected bool $isChecked = false;
public function render(): string
{
$sizeClass = match ($this->size) {
'small' => 'form-switch-slider form-switch-slider--small',
default => 'form-switch-slider',
};
$this->mergeClass('relative justify-between inline-flex items-center gap-x-2');
$checkbox = form_checkbox([
'class' => 'form-switch',
], 'yes', old($this->name) === 'yes' ? true : $this->isChecked);
$hint = $this->hint === '' ? '' : (new Hint([
'class' => 'ml-1',
'slot' => $this->hint,
]))->render();
return <<getStringifiedAttributes()}>
{$this->slot}{$hint}
{$checkbox}
HTML;
}
}