# ChoiceListInterface

> Defines the contract for form controls that render a list of choices.

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

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

Implemented by 1 type:

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

Defines the contract for form controls that render a list of choices.

Applies to grouped controls such as checkbox and radio lists. Wrapping each choice in its own `<label>` element is
exclusive to list controls, so [`enclosedByLabel()`](/docs/extensions/html-contracts/reference/form/choicelistinterface/index.md#method-enclosedByLabel) belongs to this contract rather than to a standalone one.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`enclosedByLabel()`](#method-enclosedByLabel) abstract | Sets whether each choice is wrapped by its own `<label>` element. | `ChoiceListInterface` |
| [`isList()`](#method-isList) abstract | Identifies the control as one that renders a list of choices. | `ChoiceListInterface` |

## Method details

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

```php
abstract public function enclosedByLabel(bool $value = true): static
```

Sets whether each choice is wrapped by its own `<label>` element.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool` | Whether to enclose each choice by a `<label>` element. |

**Returns**

`static`: New instance with the updated enclosing behavior.

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

```php
abstract public function isList(): true
```

Identifies the control as one that renders a list of choices.

**Returns**

`true`: Always `true`.