# AbstractChoiceList

> Provides shared immutable rendering behavior for checkbox and radio lists.

[API reference](/docs/api/index.md) › [HTML](/docs/extensions/html/reference/index.md) › [Form](/docs/extensions/html/reference/form/index.md) › AbstractChoiceList

| abstract class | `UIAwesome\Html\Form\AbstractChoiceList` |
| --- | --- |
| Extends | [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md) » [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| Implements | [`UIAwesome\Html\Contracts\Form\CheckedStateInterface`](/docs/extensions/html-contracts/reference/form/checkedstateinterface/index.md), [`UIAwesome\Html\Contracts\Form\ChoiceListInterface`](/docs/extensions/html-contracts/reference/form/choicelistinterface/index.md), [`UIAwesome\Html\Contracts\Form\FormControlInterface`](/docs/extensions/html-contracts/reference/form/formcontrolinterface/index.md), [`UIAwesome\Html\Contracts\Attribute\AttributesInterface`](/docs/extensions/html-contracts/reference/attribute/attributesinterface/index.md), [`UIAwesome\Html\Contracts\Element\BlockInterface`](/docs/extensions/html-contracts/reference/element/blockinterface/index.md), [`UIAwesome\Html\Contracts\Element\ClearableContentInterface`](/docs/extensions/html-contracts/reference/element/clearablecontentinterface/index.md), [`UIAwesome\Html\Contracts\RenderableInterface`](/docs/extensions/html-contracts/reference/renderableinterface/index.md) |
| Uses traits | [`UIAwesome\Html\Attribute\HasName`](/docs/extensions/html-attribute/reference/hasname/index.md), [`UIAwesome\Html\Attribute\Global\CanBeAutofocus`](/docs/extensions/html-attribute/reference/global/canbeautofocus/index.md), [`UIAwesome\Html\Attribute\Global\CanBeHidden`](/docs/extensions/html-attribute/reference/global/canbehidden/index.md), [`UIAwesome\Html\Attribute\Global\HasAccesskey`](/docs/extensions/html-attribute/reference/global/hasaccesskey/index.md), [`UIAwesome\Html\Attribute\Global\HasAria`](/docs/extensions/html-attribute/reference/global/hasaria/index.md), [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md), [`UIAwesome\Html\Attribute\Global\HasClass`](/docs/extensions/html-attribute/reference/global/hasclass/index.md), [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md), [`UIAwesome\Html\Attribute\Global\HasContentEditable`](/docs/extensions/html-attribute/reference/global/hascontenteditable/index.md), [`UIAwesome\Html\Attribute\Global\HasData`](/docs/extensions/html-attribute/reference/global/hasdata/index.md), [`UIAwesome\Html\Attribute\Global\HasDir`](/docs/extensions/html-attribute/reference/global/hasdir/index.md), [`UIAwesome\Html\Attribute\Global\HasDraggable`](/docs/extensions/html-attribute/reference/global/hasdraggable/index.md), [`UIAwesome\Html\Attribute\Global\HasEvents`](/docs/extensions/html-attribute/reference/global/hasevents/index.md), [`UIAwesome\Html\Attribute\Global\HasId`](/docs/extensions/html-attribute/reference/global/hasid/index.md), [`UIAwesome\Html\Attribute\Global\HasLang`](/docs/extensions/html-attribute/reference/global/haslang/index.md), [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md), [`UIAwesome\Html\Attribute\Global\HasRole`](/docs/extensions/html-attribute/reference/global/hasrole/index.md), [`UIAwesome\Html\Attribute\Global\HasSpellcheck`](/docs/extensions/html-attribute/reference/global/hasspellcheck/index.md), [`UIAwesome\Html\Attribute\Global\HasStyle`](/docs/extensions/html-attribute/reference/global/hasstyle/index.md), [`UIAwesome\Html\Attribute\Global\HasTabindex`](/docs/extensions/html-attribute/reference/global/hastabindex/index.md), [`UIAwesome\Html\Attribute\Global\HasTitle`](/docs/extensions/html-attribute/reference/global/hastitle/index.md), [`UIAwesome\Html\Attribute\Global\HasTranslate`](/docs/extensions/html-attribute/reference/global/hastranslate/index.md), [`UIAwesome\Html\Core\Event\HasAfterRun`](/docs/extensions/html-core/reference/event/hasafterrun/index.md), [`UIAwesome\Html\Core\Event\HasBeforeRun`](/docs/extensions/html-core/reference/event/hasbeforerun/index.md) |
| Source | [`src/Form/AbstractChoiceList.php`](https://github.com/ui-awesome/html/blob/main/src/Form/AbstractChoiceList.php#L32) |

2 subclasses:

- [`CheckboxList`](/docs/extensions/html/reference/form/checkboxlist/index.md)
- [`RadioList`](/docs/extensions/html/reference/form/radiolist/index.md)

Provides shared immutable rendering behavior for checkbox and radio lists.

Renders every [`ChoiceItem`](/docs/extensions/html/reference/form/choiceitem/index.md) as an atomic input paired with a `<label>`, wrapped in a container element that
carries the list attributes. Selection is configured on the list through [`checked()`](/docs/extensions/html/reference/form/abstractchoicelist/index.md#method-checked), never on the items.

[`CheckboxList`](/docs/extensions/html/reference/form/checkboxlist/index.md) for the checkbox implementation.
[`RadioList`](/docs/extensions/html/reference/form/radiolist/index.md) for the radio implementation.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-attributes"></span>[`$attributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md#property-attributes) protected | `mixed[]` | HTML attributes array used by the implementing class. Default: `[]`. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="property-content"></span>[`$content`](/docs/extensions/html-mixin/reference/hascontent/index.md#property-content) protected | `string` | Content string assigned to the element. Default: `''`. | [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-__construct) final | Initializes a new tag instance. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| <span id="method-__toString"></span>[`__toString()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-__toString) | Returns the rendered tag string. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| <span id="method-accesskey"></span>[`accesskey()`](/docs/extensions/html-attribute/reference/global/hasaccesskey/index.md#method-accesskey) | Sets the `accesskey` attribute. | [`UIAwesome\Html\Attribute\Global\HasAccesskey`](/docs/extensions/html-attribute/reference/global/hasaccesskey/index.md) |
| <span id="method-addAriaAttribute"></span>[`addAriaAttribute()`](/docs/extensions/html-attribute/reference/global/hasaria/index.md#method-addAriaAttribute) | Sets an `aria-*` attribute. | [`UIAwesome\Html\Attribute\Global\HasAria`](/docs/extensions/html-attribute/reference/global/hasaria/index.md) |
| <span id="method-addAttribute"></span>[`addAttribute()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-addAttribute) | Adds or updates a single HTML attribute for the element. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-addDataAttribute"></span>[`addDataAttribute()`](/docs/extensions/html-attribute/reference/global/hasdata/index.md#method-addDataAttribute) | Sets a `data-*` attribute. | [`UIAwesome\Html\Attribute\Global\HasData`](/docs/extensions/html-attribute/reference/global/hasdata/index.md) |
| <span id="method-addEvent"></span>[`addEvent()`](/docs/extensions/html-attribute/reference/global/hasevents/index.md#method-addEvent) | Sets an `on*` event attribute. | [`UIAwesome\Html\Attribute\Global\HasEvents`](/docs/extensions/html-attribute/reference/global/hasevents/index.md) |
| <span id="method-ariaAttributes"></span>[`ariaAttributes()`](/docs/extensions/html-attribute/reference/global/hasaria/index.md#method-ariaAttributes) | Sets multiple `aria-*` attributes. | [`UIAwesome\Html\Attribute\Global\HasAria`](/docs/extensions/html-attribute/reference/global/hasaria/index.md) |
| <span id="method-attributes"></span>[`attributes()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-attributes) | Adds or updates multiple HTML attributes for the element. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-autofocus"></span>[`autofocus()`](/docs/extensions/html-attribute/reference/global/canbeautofocus/index.md#method-autofocus) | Sets the `autofocus` attribute. | [`UIAwesome\Html\Attribute\Global\CanBeAutofocus`](/docs/extensions/html-attribute/reference/global/canbeautofocus/index.md) |
| <span id="method-begin"></span>[`begin()`](/docs/extensions/html-core/reference/element/baseblock/index.md#method-begin) final | Starts begin/end rendering for this instance. | [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md) |
| [`checked()`](#method-checked) | Sets the values determining which items are checked. | `AbstractChoiceList` |
| <span id="method-class"></span>[`class()`](/docs/extensions/html-attribute/reference/global/hasclass/index.md#method-class) | Sets the `class` attribute. | [`UIAwesome\Html\Attribute\Global\HasClass`](/docs/extensions/html-attribute/reference/global/hasclass/index.md) |
| <span id="method-clearContent"></span>[`clearContent()`](/docs/extensions/html-mixin/reference/hascontent/index.md#method-clearContent) | Clears encoded and raw content without changing other component state. | [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md) |
| <span id="method-config"></span>[`config()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-config) | Applies application-scoped config recipes to this tag. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| <span id="method-content"></span>[`content()`](/docs/extensions/html-mixin/reference/hascontent/index.md#method-content) | Appends encoded content. | [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md) |
| <span id="method-contentEditable"></span>[`contentEditable()`](/docs/extensions/html-attribute/reference/global/hascontenteditable/index.md#method-contentEditable) | Sets the `contenteditable` attribute. | [`UIAwesome\Html\Attribute\Global\HasContentEditable`](/docs/extensions/html-attribute/reference/global/hascontenteditable/index.md) |
| <span id="method-dataAttributes"></span>[`dataAttributes()`](/docs/extensions/html-attribute/reference/global/hasdata/index.md#method-dataAttributes) | Sets multiple `data-*` attributes. | [`UIAwesome\Html\Attribute\Global\HasData`](/docs/extensions/html-attribute/reference/global/hasdata/index.md) |
| <span id="method-dir"></span>[`dir()`](/docs/extensions/html-attribute/reference/global/hasdir/index.md#method-dir) | Sets the `dir` attribute. | [`UIAwesome\Html\Attribute\Global\HasDir`](/docs/extensions/html-attribute/reference/global/hasdir/index.md) |
| <span id="method-draggable"></span>[`draggable()`](/docs/extensions/html-attribute/reference/global/hasdraggable/index.md#method-draggable) | Sets the `draggable` attribute. | [`UIAwesome\Html\Attribute\Global\HasDraggable`](/docs/extensions/html-attribute/reference/global/hasdraggable/index.md) |
| [`enclosedByLabel()`](#method-enclosedByLabel) | Configures whether every item input and its text are enclosed by the item label. | `AbstractChoiceList` |
| <span id="method-end"></span>[`end()`](/docs/extensions/html-core/reference/element/baseblock/index.md#method-end) static final | Ends the most recent begin/end rendering block for the current class. | [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md) |
| <span id="method-events"></span>[`events()`](/docs/extensions/html-attribute/reference/global/hasevents/index.md#method-events) | Sets multiple `on*` event attributes. | [`UIAwesome\Html\Attribute\Global\HasEvents`](/docs/extensions/html-attribute/reference/global/hasevents/index.md) |
| <span id="method-getAttribute"></span>[`getAttribute()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-getAttribute) | Returns the value of a single HTML attribute. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-getAttributes"></span>[`getAttributes()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-getAttributes) | Returns the `array` of HTML attributes for the element. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-getContent"></span>[`getContent()`](/docs/extensions/html-mixin/reference/hascontent/index.md#method-getContent) | Returns the content assigned to the element. | [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md) |
| <span id="method-hidden"></span>[`hidden()`](/docs/extensions/html-attribute/reference/global/canbehidden/index.md#method-hidden) | Sets the `hidden` attribute. | [`UIAwesome\Html\Attribute\Global\CanBeHidden`](/docs/extensions/html-attribute/reference/global/canbehidden/index.md) |
| <span id="method-html"></span>[`html()`](/docs/extensions/html-mixin/reference/hascontent/index.md#method-html) | Appends trusted raw HTML content without encoding or sanitizing it. | [`UIAwesome\Html\Mixin\HasContent`](/docs/extensions/html-mixin/reference/hascontent/index.md) |
| <span id="method-id"></span>[`id()`](/docs/extensions/html-attribute/reference/global/hasid/index.md#method-id) | Sets the `id` attribute. | [`UIAwesome\Html\Attribute\Global\HasId`](/docs/extensions/html-attribute/reference/global/hasid/index.md) |
| [`isList()`](#method-isList) | Identifies this control as a list so field wrappers render a group label instead of a `for` label. | `AbstractChoiceList` |
| [`itemAttributes()`](#method-itemAttributes) | Sets attributes applied to every item input. | `AbstractChoiceList` |
| [`itemContainerAttributes()`](#method-itemContainerAttributes) | Sets attributes applied to the container enclosing every item input and label. | `AbstractChoiceList` |
| [`itemContainerClass()`](#method-itemContainerClass) | Adds CSS classes to the container enclosing every item input and label. | `AbstractChoiceList` |
| [`itemContainerTag()`](#method-itemContainerTag) | Sets the tag enclosing every item input and label. | `AbstractChoiceList` |
| <span id="method-itemId"></span>[`itemId()`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md#method-itemId) | Sets the `itemid` attribute. | [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md) |
| [`itemLabelAttributes()`](#method-itemLabelAttributes) | Sets default attributes applied to every item label. | `AbstractChoiceList` |
| [`itemLabelClass()`](#method-itemLabelClass) | Adds CSS classes to every item label. | `AbstractChoiceList` |
| <span id="method-itemProp"></span>[`itemProp()`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md#method-itemProp) | Sets the `itemprop` attribute. | [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md) |
| <span id="method-itemRef"></span>[`itemRef()`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md#method-itemRef) | Sets the `itemref` attribute. | [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md) |
| [`items()`](#method-items) | Replaces the items rendered by the list. | `AbstractChoiceList` |
| <span id="method-itemScope"></span>[`itemScope()`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md#method-itemScope) | Sets the `itemscope` attribute. | [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md) |
| <span id="method-itemType"></span>[`itemType()`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md#method-itemType) | Sets the `itemtype` attribute. | [`UIAwesome\Html\Attribute\Global\HasMicroData`](/docs/extensions/html-attribute/reference/global/hasmicrodata/index.md) |
| <span id="method-lang"></span>[`lang()`](/docs/extensions/html-attribute/reference/global/haslang/index.md#method-lang) | Sets the `lang` attribute. | [`UIAwesome\Html\Attribute\Global\HasLang`](/docs/extensions/html-attribute/reference/global/haslang/index.md) |
| <span id="method-name"></span>[`name()`](/docs/extensions/html-attribute/reference/hasname/index.md#method-name) | Sets the `name` attribute. | [`UIAwesome\Html\Attribute\HasName`](/docs/extensions/html-attribute/reference/hasname/index.md) |
| <span id="method-removeAriaAttribute"></span>[`removeAriaAttribute()`](/docs/extensions/html-attribute/reference/global/hasaria/index.md#method-removeAriaAttribute) | Removes an `aria-*` attribute. | [`UIAwesome\Html\Attribute\Global\HasAria`](/docs/extensions/html-attribute/reference/global/hasaria/index.md) |
| <span id="method-removeAttribute"></span>[`removeAttribute()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-removeAttribute) | Removes a specific HTML attribute from the element. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-removeDataAttribute"></span>[`removeDataAttribute()`](/docs/extensions/html-attribute/reference/global/hasdata/index.md#method-removeDataAttribute) | Removes a `data-*` attribute. | [`UIAwesome\Html\Attribute\Global\HasData`](/docs/extensions/html-attribute/reference/global/hasdata/index.md) |
| <span id="method-removeEvent"></span>[`removeEvent()`](/docs/extensions/html-attribute/reference/global/hasevents/index.md#method-removeEvent) | Removes an `on*` event attribute. | [`UIAwesome\Html\Attribute\Global\HasEvents`](/docs/extensions/html-attribute/reference/global/hasevents/index.md) |
| <span id="method-render"></span>[`render()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-render) final | Renders the tag with lifecycle hooks. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| <span id="method-replaceAttributes"></span>[`replaceAttributes()`](/docs/extensions/html-mixin/reference/hasattributes/index.md#method-replaceAttributes) | Replaces all HTML attributes for the element. | [`UIAwesome\Html\Mixin\HasAttributes`](/docs/extensions/html-mixin/reference/hasattributes/index.md) |
| <span id="method-role"></span>[`role()`](/docs/extensions/html-attribute/reference/global/hasrole/index.md#method-role) | Sets the `role` attribute. | [`UIAwesome\Html\Attribute\Global\HasRole`](/docs/extensions/html-attribute/reference/global/hasrole/index.md) |
| <span id="method-spellcheck"></span>[`spellcheck()`](/docs/extensions/html-attribute/reference/global/hasspellcheck/index.md#method-spellcheck) | Sets the `spellcheck` attribute. | [`UIAwesome\Html\Attribute\Global\HasSpellcheck`](/docs/extensions/html-attribute/reference/global/hasspellcheck/index.md) |
| <span id="method-style"></span>[`style()`](/docs/extensions/html-attribute/reference/global/hasstyle/index.md#method-style) | Sets the `style` attribute. | [`UIAwesome\Html\Attribute\Global\HasStyle`](/docs/extensions/html-attribute/reference/global/hasstyle/index.md) |
| <span id="method-tabIndex"></span>[`tabIndex()`](/docs/extensions/html-attribute/reference/global/hastabindex/index.md#method-tabIndex) | Sets the `tabindex` attribute. | [`UIAwesome\Html\Attribute\Global\HasTabindex`](/docs/extensions/html-attribute/reference/global/hastabindex/index.md) |
| <span id="method-tag"></span>[`tag()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-tag) static | Creates and configures a new tag instance. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| <span id="method-title"></span>[`title()`](/docs/extensions/html-attribute/reference/global/hastitle/index.md#method-title) | Sets the `title` attribute. | [`UIAwesome\Html\Attribute\Global\HasTitle`](/docs/extensions/html-attribute/reference/global/hastitle/index.md) |
| <span id="method-translate"></span>[`translate()`](/docs/extensions/html-attribute/reference/global/hastranslate/index.md#method-translate) | Sets the `translate` attribute. | [`UIAwesome\Html\Attribute\Global\HasTranslate`](/docs/extensions/html-attribute/reference/global/hastranslate/index.md) |
| [`uncheckedValue()`](#method-uncheckedValue) | Sets the value submitted when no list item is selected. | `AbstractChoiceList` |
| <span id="method-afterRun"></span>[`afterRun()`](/docs/extensions/html-core/reference/event/hasafterrun/index.md#method-afterRun) protected | Post-processes rendered output. | [`UIAwesome\Html\Core\Event\HasAfterRun`](/docs/extensions/html-core/reference/event/hasafterrun/index.md) |
| <span id="method-beforeRun"></span>[`beforeRun()`](/docs/extensions/html-core/reference/event/hasbeforerun/index.md#method-beforeRun) protected | Validates state before rendering. | [`UIAwesome\Html\Core\Event\HasBeforeRun`](/docs/extensions/html-core/reference/event/hasbeforerun/index.md) |
| [`createInput()`](#method-createInput) protected abstract | Creates the atomic input used for each item. | `AbstractChoiceList` |
| [`getTag()`](#method-getTag) protected | Returns the tag enumeration for the list container. | `AbstractChoiceList` |
| <span id="method-isBeginExecuted"></span>[`isBeginExecuted()`](/docs/extensions/html-core/reference/element/baseblock/index.md#method-isBeginExecuted) protected | Indicates whether this instance has an open or closing operation in the current context. | [`UIAwesome\Html\Core\Element\BaseBlock`](/docs/extensions/html-core/reference/element/baseblock/index.md) |
| <span id="method-loadDefault"></span>[`loadDefault()`](/docs/extensions/html-core/reference/base/basetag/index.md#method-loadDefault) protected | Returns class-level default definitions. | [`UIAwesome\Html\Core\Base\BaseTag`](/docs/extensions/html-core/reference/base/basetag/index.md) |
| [`run()`](#method-run) protected | Renders the list container with its content, the unchecked input, and every item. | `AbstractChoiceList` |
| [`runBegin()`](#method-runBegin) protected | Returns the opening tag for begin/end rendering. | `AbstractChoiceList` |
| [`usesArrayName()`](#method-usesArrayName) protected abstract | Returns whether item names use array notation. | `AbstractChoiceList` |

## Method details

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

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

Sets the values determining which items are checked.

**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` | Checked values. - `array`: Every item whose value is in the array is checked. - `false`: No item is checked. - `true`: Every item is checked. - `float\|int\|string\|Stringable\|UnitEnum`: The item whose value matches is checked. - `null`: No item is checked. |

**Returns**

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

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

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

Configures whether every item input and its text are enclosed by the item label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `bool` | Enclosure state. Use `true` to wrap the input inside its `<label>`, `false` to render the input and the label as siblings. |

**Returns**

`static`: New instance with the updated label enclosure state.

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

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

Identifies this control as a list so field wrappers render a group label instead of a `for` label.

**Returns**

`true`: Always `true`.

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

```php
public function itemAttributes(mixed[] $values): static
```

Sets attributes applied to every item input.

Merges with the attributes already configured, so consecutive calls accumulate.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$values` | `mixed[]` | Input attributes indexed by attribute name. |

**Returns**

`static`: New instance with the updated item attributes.

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

```php
public function itemContainerAttributes(mixed[] $values): static
```

Sets attributes applied to the container enclosing every item input and label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$values` | `mixed[]` | Container attributes indexed by attribute name. |

**Returns**

`static`: New instance with the updated item container attributes.

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

```php
public function itemContainerClass(mixed[]|string|Stringable|UnitEnum|null $value, bool $override = false): static
```

Adds CSS classes to the container enclosing every item input and label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed[]\|string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Classes to add, or `null` to keep the current class list. |
| `$override` | `bool` | Whether to replace the current class list instead of appending. |

**Returns**

`static`: New instance with the updated item container classes.

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

```php
public function itemContainerTag(UIAwesome\Html\Interop\Block|false|UIAwesome\Html\Interop\Inline|UIAwesome\Html\Interop\Lists|UIAwesome\Html\Interop\MetadataBlock|UIAwesome\Html\Interop\Root|UIAwesome\Html\Form\Values\SelectTag|UIAwesome\Html\Interop\Table $value): static
```

Sets the tag enclosing every item input and label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | [`Block`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Block.php)`\|false\|`[`Inline`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Inline.php)`\|`[`Lists`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Lists.php)`\|`[`MetadataBlock`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/MetadataBlock.php)`\|`[`Root`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Root.php)`\|`[`UIAwesome\Html\Form\Values\SelectTag`](/docs/extensions/html/reference/form/values/selecttag/index.md)`\|`[`Table`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Table.php) | Item container tag, or `false` to render items without wrappers. |

**Returns**

`static`: New instance with the updated item container tag.

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

```php
public function itemLabelAttributes(mixed[] $values): static
```

Sets default attributes applied to every item label.

Attributes configured directly on a [`ChoiceItem`](/docs/extensions/html/reference/form/choiceitem/index.md) take precedence, while CSS classes are appended.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$values` | `mixed[]` | Label attributes indexed by attribute name. |

**Returns**

`static`: New instance with the updated item label attributes.

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

```php
public function itemLabelClass(mixed[]|string|Stringable|UnitEnum|null $value, bool $override = false): static
```

Adds CSS classes to every item label.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `mixed[]\|string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Classes to add, or `null` to keep the current class list. |
| `$override` | `bool` | Whether to replace the current class list instead of appending. |

**Returns**

`static`: New instance with the updated item label classes.

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

```php
public function items(UIAwesome\Html\Form\ChoiceItem ...$items): static
```

Replaces the items rendered by the list.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `...$items` | [`ChoiceItem`](/docs/extensions/html/reference/form/choiceitem/index.md) | Item instances rendered in order. |

**Returns**

`static`: New instance with the replacement items.

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

```php
public function uncheckedValue(bool|float|int|string|Stringable|UnitEnum|null $value): static
```

Sets the value submitted when no list item is selected.

Renders a hidden input carrying the list name before the items, and is skipped when the list has no name.

The hidden input always carries the plain list name, never the `name[]` form used by [`CheckboxList`](/docs/extensions/html/reference/form/checkboxlist/index.md) items,
so that a checked item overwrites the fallback under PHP's query-string parsing: `name=0&name[]=1` yields
`['1']`, while `name[]=0&name[]=1` would keep the fallback as `['0', '1']`. Consumers that do not apply that
bracket normalization, such as the `FormData` API, receive `name` and `name[]` as separate keys.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `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` | Fallback value, or `null` to omit the hidden input. |

**Returns**

`static`: New instance with the updated unchecked value.

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

```php
abstract protected function createInput(): UIAwesome\Html\Form\InputCheckbox|UIAwesome\Html\Form\InputRadio
```

Creates the atomic input used for each item.

**Returns**

[`InputCheckbox`](/docs/extensions/html/reference/form/inputcheckbox/index.md)`|`[`InputRadio`](/docs/extensions/html/reference/form/inputradio/index.md): Input element instance rendered for every item.

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

```php
protected function getTag(): UIAwesome\Html\Interop\Block
```

Returns the tag enumeration for the list container.

**Returns**

[`Block`](https://github.com/ui-awesome/html-interop/blob/bbc56fa772c4b4772a6a83d4a3e602c5c27313c9/src/Block.php): Tag enumeration instance for `<div>`.

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

```php
protected function run(): string
```

Renders the list container with its content, the unchecked input, and every item.

The `name` attribute is transferred to the item inputs instead of being serialized on the container.

**Returns**

`string`: Rendered HTML for the choice list.

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

```php
protected function runBegin(): string
```

Returns the opening tag for begin/end rendering.

**Returns**

`string`: Opening HTML tag for the list container.

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

```php
abstract protected function usesArrayName(): bool
```

Returns whether item names use array notation.

**Returns**

`bool`: `true` when every item input is named `name[]`, `false` when items share the plain list name.