# CheckedStateInterface

> Defines the contract for form controls that expose the checked attribute.

[API reference](/docs/api/index.md) › [HTML Contracts](/docs/extensions/html-contracts/reference/index.md) › [Form](/docs/extensions/html-contracts/reference/form/index.md) › CheckedStateInterface

| interface | `UIAwesome\Html\Contracts\Form\CheckedStateInterface` |
| --- | --- |
| Source | [`src/Form/CheckedStateInterface.php`](https://github.com/ui-awesome/html-contracts/blob/main/src/Form/CheckedStateInterface.php#L16) |

Implemented by 3 types:

- [`UIAwesome\Html\Form\AbstractChoiceList`](/docs/extensions/html/reference/form/abstractchoicelist/index.md)
- [`UIAwesome\Html\Form\InputCheckbox`](/docs/extensions/html/reference/form/inputcheckbox/index.md)
- [`UIAwesome\Html\Form\InputRadio`](/docs/extensions/html/reference/form/inputradio/index.md)

Defines the contract for form controls that expose the `checked` attribute.

Applies to checkbox and radio controls, where the supplied value is matched against the control value to resolve the
checked state.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`checked()`](#method-checked) abstract | Sets the `checked` attribute. | `CheckedStateInterface` |

## Method details

### checked() <span id="method-checked"></span>

```php
abstract public function checked(mixed[]|bool|float|int|string|Stringable|UnitEnum|null $value): static
```

Sets the `checked` attribute.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed[]\|bool\|float\|int\|string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Value matched against the control value to resolve the checked state, or `null` to remove the attribute. |

**Returns**

`static`: New instance with the updated `checked` attribute.