Skip to content
PHP Ecosystem
Explore

HasCheckedState

API reference › HTML › Form › Mixin › HasCheckedState

traitUIAwesome\Html\Form\Mixin\HasCheckedState
Sourcesrc/Form/Mixin/HasCheckedState.php
Used by 2 types

Provides methods to configure the checked state of form elements like checkboxes and radio buttons.

MethodDescriptionDefined by
checked()Sets the checked attribute.HasCheckedState
public function checked(bool|float|int|mixed[]|string|Stringable|UnitEnum|null $value): static

Sets the checked attribute.

Parameters

ParameterTypeDescription
$valuebool|float|int|mixed[]|string|Stringable|UnitEnum|nullChecked state. - array: Element is checked if the value is in the array. - false: Element is unchecked. - true: Element is checked. - float|int|string|Stringable|UnitEnum: Element is checked if the value matches the value attribute, or on when the element has no value attribute. - null: Attribute is removed.

Returns

static: New instance with the updated checked attribute.