Boolean
The #[Boolean]
property type will render a lightswitch input in the field properties panel.
use Solspace\Freeform\Attributes\Property\Input\Boolean;
// ...
#[Boolean(
label: 'Is Required',
instructions: 'Enable this to make the field required.',
)]
protected bool $isRequired = false;
Result
The default value will be inferred from the PHP's property value, in this case false
.