# BaseHtml

> Provides the Bootstrap 6 implementation of yii2\extensions\bootstrap6\Html.

[API reference](/docs/api/index.md) › [Bootstrap 6](/docs/extensions/bootstrap6/reference/index.md) › BaseHtml

| abstract class | `yii2\extensions\bootstrap6\BaseHtml` |
| --- | --- |
| Extends | [`yii\helpers\Html`](/docs/api/yii/helpers/html/index.md) » [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| Source | [`src/BaseHtml.php`](https://github.com/yii2-extensions/bootstrap6/blob/main/src/BaseHtml.php#L40) |

1 subclass:

- [`Html`](/docs/extensions/bootstrap6/reference/html/index.md)

Provides the Bootstrap 6 implementation of [`Html`](/docs/extensions/bootstrap6/reference/html/index.md).

Checkboxes and radios render the `.check` and `.radio` classes, switches render the `.switch` wrapper, and error
blocks default to `.invalid-feedback`.

See also: <https://getbootstrap.com/docs/6.0/forms/field/>.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-attributeOrder"></span>[`$attributeOrder`](/docs/api/yii/helpers/basehtml/index.md#property-attributeOrder) static | `array` | The preferred order of attributes in a tag. Default: `['type', 'id', 'class', 'name', 'value', 'href', 'src', 'srcset', 'form', 'action', 'method', 'selected', 'checked', 'readonly', 'disabled', 'multiple', 'size', 'maxlength', 'width', 'height', 'rows', 'cols', 'alt', 'title', 'rel', 'media']`. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="property-attributeRegex"></span>[`$attributeRegex`](/docs/api/yii/helpers/basehtml/index.md#property-attributeRegex) static | `string` | Regular expression used for attribute name validation. Default: `'/(^\|.*\])([\w\.\+]+)(\[.*\|$)/u'`. Available since 2.0.12. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="property-autoIdPrefix"></span>`$autoIdPrefix` static | `string` | Prefix of the `id` values generated for checkbox and radio labels. Default: `'i'`. | `BaseHtml` |
| <span id="property-dataAttributes"></span>[`$dataAttributes`](/docs/api/yii/helpers/basehtml/index.md#property-dataAttributes) static | `array` | List of tag attributes that should be specially handled when their values are of array type. Default: `['aria', 'data', 'data-ng', 'ng']`. Available since 2.0.3. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="property-normalizeClassAttribute"></span>`$normalizeClassAttribute` static | `bool` | Whether to remove duplicated classes when rendering the `class` attribute. Default: `true`. | `BaseHtml` |
| <span id="property-voidElements"></span>[`$voidElements`](/docs/api/yii/helpers/basehtml/index.md#property-voidElements) static | `array` | List of void elements (element name => 1) Default: `['area' => 1, 'base' => 1, 'br' => 1, 'col' => 1, 'command' => 1, 'embed' => 1, 'hr' => 1, 'img' => 1, 'input' => 1, 'keygen' => 1, 'link' => 1, 'meta' => 1, 'param' => 1, 'source' => 1, 'track' => 1, 'wbr' => 1]`. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-a"></span>[`a()`](/docs/api/yii/helpers/basehtml/index.md#method-a) static | Generates a hyperlink tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeCheckbox"></span>[`activeCheckbox()`](/docs/api/yii/helpers/basehtml/index.md#method-activeCheckbox) static | Generates a checkbox tag together with a label for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeCheckboxList"></span>[`activeCheckboxList()`](/docs/api/yii/helpers/basehtml/index.md#method-activeCheckboxList) static | Generates a list of checkboxes. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeDropDownList"></span>[`activeDropDownList()`](/docs/api/yii/helpers/basehtml/index.md#method-activeDropDownList) static | Generates a drop-down list for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeFileInput"></span>[`activeFileInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeFileInput) static | Generates a file input tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeHiddenInput"></span>[`activeHiddenInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeHiddenInput) static | Generates a hidden input tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeHint"></span>[`activeHint()`](/docs/api/yii/helpers/basehtml/index.md#method-activeHint) static | Generates a hint tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeInput"></span>[`activeInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeInput) static | Generates an input tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeLabel"></span>[`activeLabel()`](/docs/api/yii/helpers/basehtml/index.md#method-activeLabel) static | Generates a label tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeListBox"></span>[`activeListBox()`](/docs/api/yii/helpers/basehtml/index.md#method-activeListBox) static | Generates a list box. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activePasswordInput"></span>[`activePasswordInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activePasswordInput) static | Generates a password input tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeRadio"></span>[`activeRadio()`](/docs/api/yii/helpers/basehtml/index.md#method-activeRadio) static | Generates a radio button tag together with a label for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeRadioList"></span>[`activeRadioList()`](/docs/api/yii/helpers/basehtml/index.md#method-activeRadioList) static | Generates a list of radio buttons. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`activeStaticControl()`](#method-activeStaticControl) static | Generates a static form control for the given model attribute. | `BaseHtml` |
| <span id="method-activeTextarea"></span>[`activeTextarea()`](/docs/api/yii/helpers/basehtml/index.md#method-activeTextarea) static | Generates a textarea tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeTextInput"></span>[`activeTextInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeTextInput) static | Generates a text input tag for the given model attribute. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`addCssClass()`](#method-addCssClass) static | Adds CSS classes to the options; enum cases are converted to their value (backed) or name (pure). | `BaseHtml` |
| <span id="method-addCssStyle"></span>[`addCssStyle()`](/docs/api/yii/helpers/basehtml/index.md#method-addCssStyle) static | Adds the specified CSS style to the HTML options. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`badge()`](#method-badge) static | Generates a badge. | `BaseHtml` |
| <span id="method-beginForm"></span>[`beginForm()`](/docs/api/yii/helpers/basehtml/index.md#method-beginForm) static | Generates a form start tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-beginTag"></span>[`beginTag()`](/docs/api/yii/helpers/basehtml/index.md#method-beginTag) static | Generates a start tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-button"></span>[`button()`](/docs/api/yii/helpers/basehtml/index.md#method-button) static | Generates a button tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-buttonInput"></span>[`buttonInput()`](/docs/api/yii/helpers/basehtml/index.md#method-buttonInput) static | Generates an input button. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-checkbox"></span>[`checkbox()`](/docs/api/yii/helpers/basehtml/index.md#method-checkbox) static | Generates a checkbox input. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`checkboxList()`](#method-checkboxList) static | Generates a list of Bootstrap checkboxes, each wrapped in a `.form-field` element. | `BaseHtml` |
| [`closeButton()`](#method-closeButton) static | Generates a close button with a translated `aria-label`. | `BaseHtml` |
| <span id="method-csrfMetaTags"></span>[`csrfMetaTags()`](/docs/api/yii/helpers/basehtml/index.md#method-csrfMetaTags) static | Generates the meta tags containing CSRF token information. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-cssFile"></span>[`cssFile()`](/docs/api/yii/helpers/basehtml/index.md#method-cssFile) static | Generates a link tag that refers to an external CSS file. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-cssStyleFromArray"></span>[`cssStyleFromArray()`](/docs/api/yii/helpers/basehtml/index.md#method-cssStyleFromArray) static | Converts a CSS style array into a string representation. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-cssStyleToArray"></span>[`cssStyleToArray()`](/docs/api/yii/helpers/basehtml/index.md#method-cssStyleToArray) static | Converts a CSS style string into an array representation. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-decode"></span>[`decode()`](/docs/api/yii/helpers/basehtml/index.md#method-decode) static | Decodes special HTML entities back to the corresponding characters. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-dropDownList"></span>[`dropDownList()`](/docs/api/yii/helpers/basehtml/index.md#method-dropDownList) static | Generates a drop-down list. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-encode"></span>[`encode()`](/docs/api/yii/helpers/basehtml/index.md#method-encode) static | Encodes special characters into HTML entities. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-endForm"></span>[`endForm()`](/docs/api/yii/helpers/basehtml/index.md#method-endForm) static | Generates a form end tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-endTag"></span>[`endTag()`](/docs/api/yii/helpers/basehtml/index.md#method-endTag) static | Generates an end tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`enumValue()`](#method-enumValue) static | Returns the `string` value of an enum-typed value, validating strings against the enum. | `BaseHtml` |
| [`error()`](#method-error) static |  | `BaseHtml` |
| <span id="method-errorSummary"></span>[`errorSummary()`](/docs/api/yii/helpers/basehtml/index.md#method-errorSummary) static | Generates a summary of the validation errors. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`escapeCssIdentifier()`](#method-escapeCssIdentifier) static | Escapes a string for use as a CSS identifier in a selector, as `CSS.escape()` does. | `BaseHtml` |
| <span id="method-escapeJsRegularExpression"></span>[`escapeJsRegularExpression()`](/docs/api/yii/helpers/basehtml/index.md#method-escapeJsRegularExpression) static | Escapes regular expression to use in JavaScript. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-fileInput"></span>[`fileInput()`](/docs/api/yii/helpers/basehtml/index.md#method-fileInput) static | Generates a file input field. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-getAttributeName"></span>[`getAttributeName()`](/docs/api/yii/helpers/basehtml/index.md#method-getAttributeName) static | Returns the real attribute name from the given attribute expression. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-getAttributeValue"></span>[`getAttributeValue()`](/docs/api/yii/helpers/basehtml/index.md#method-getAttributeValue) static | Returns the value of the specified attribute name or expression. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-getInputId"></span>[`getInputId()`](/docs/api/yii/helpers/basehtml/index.md#method-getInputId) static | Generates an appropriate input ID for the specified attribute name or expression. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-getInputIdByName"></span>[`getInputIdByName()`](/docs/api/yii/helpers/basehtml/index.md#method-getInputIdByName) static | Converts input name to ID. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-getInputName"></span>[`getInputName()`](/docs/api/yii/helpers/basehtml/index.md#method-getInputName) static | Generates an appropriate input name for the specified attribute name or expression. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-hiddenInput"></span>[`hiddenInput()`](/docs/api/yii/helpers/basehtml/index.md#method-hiddenInput) static | Generates a hidden input field. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-img"></span>[`img()`](/docs/api/yii/helpers/basehtml/index.md#method-img) static | Generates an image tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-input"></span>[`input()`](/docs/api/yii/helpers/basehtml/index.md#method-input) static | Generates an input type of the given type. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-jsFile"></span>[`jsFile()`](/docs/api/yii/helpers/basehtml/index.md#method-jsFile) static | Generates a script tag that refers to an external JavaScript file. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-label"></span>[`label()`](/docs/api/yii/helpers/basehtml/index.md#method-label) static | Generates a label tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-listBox"></span>[`listBox()`](/docs/api/yii/helpers/basehtml/index.md#method-listBox) static | Generates a list box. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-mailto"></span>[`mailto()`](/docs/api/yii/helpers/basehtml/index.md#method-mailto) static | Generates a mailto hyperlink. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-ol"></span>[`ol()`](/docs/api/yii/helpers/basehtml/index.md#method-ol) static | Generates an ordered list. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-passwordInput"></span>[`passwordInput()`](/docs/api/yii/helpers/basehtml/index.md#method-passwordInput) static | Generates a password input field. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-radio"></span>[`radio()`](/docs/api/yii/helpers/basehtml/index.md#method-radio) static | Generates a radio button input. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`radioList()`](#method-radioList) static | Generates a list of Bootstrap radios, each wrapped in a `.form-field` element. | `BaseHtml` |
| <span id="method-removeCssClass"></span>[`removeCssClass()`](/docs/api/yii/helpers/basehtml/index.md#method-removeCssClass) static | Removes a CSS class from the specified options. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-removeCssStyle"></span>[`removeCssStyle()`](/docs/api/yii/helpers/basehtml/index.md#method-removeCssStyle) static | Removes the specified CSS style from the HTML options. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-renderSelectOptions"></span>[`renderSelectOptions()`](/docs/api/yii/helpers/basehtml/index.md#method-renderSelectOptions) static | Renders the option tags that can be used by [`dropDownList()`](/docs/api/yii/helpers/basehtml/index.md#method-dropDownList) and [`listBox()`](/docs/api/yii/helpers/basehtml/index.md#method-listBox). | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-renderTagAttributes"></span>[`renderTagAttributes()`](/docs/api/yii/helpers/basehtml/index.md#method-renderTagAttributes) static | Renders the HTML tag attributes. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-resetButton"></span>[`resetButton()`](/docs/api/yii/helpers/basehtml/index.md#method-resetButton) static | Generates a reset button tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-resetInput"></span>[`resetInput()`](/docs/api/yii/helpers/basehtml/index.md#method-resetInput) static | Generates a reset input button. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-script"></span>[`script()`](/docs/api/yii/helpers/basehtml/index.md#method-script) static | Generates a script tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`staticControl()`](#method-staticControl) static | Generates a read-only plain-text input. | `BaseHtml` |
| <span id="method-style"></span>[`style()`](/docs/api/yii/helpers/basehtml/index.md#method-style) static | Generates a style tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-submitButton"></span>[`submitButton()`](/docs/api/yii/helpers/basehtml/index.md#method-submitButton) static | Generates a submit button tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-submitInput"></span>[`submitInput()`](/docs/api/yii/helpers/basehtml/index.md#method-submitInput) static | Generates a submit input button. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-tag"></span>[`tag()`](/docs/api/yii/helpers/basehtml/index.md#method-tag) static | Generates a complete HTML tag. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-textarea"></span>[`textarea()`](/docs/api/yii/helpers/basehtml/index.md#method-textarea) static | Generates a text area input. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-textInput"></span>[`textInput()`](/docs/api/yii/helpers/basehtml/index.md#method-textInput) static | Generates a text input field. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`theme()`](#method-theme) static | Adds the `theme-{value}` class to the options. | `BaseHtml` |
| <span id="method-ul"></span>[`ul()`](/docs/api/yii/helpers/basehtml/index.md#method-ul) static | Generates an unordered list. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeBooleanInput"></span>[`activeBooleanInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeBooleanInput) protected static | Generates a boolean input This method is mainly called by [`activeCheckbox()`](/docs/api/yii/helpers/basehtml/index.md#method-activeCheckbox) and [`activeRadio()`](/docs/api/yii/helpers/basehtml/index.md#method-activeRadio). | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| <span id="method-activeListInput"></span>[`activeListInput()`](/docs/api/yii/helpers/basehtml/index.md#method-activeListInput) protected static | Generates a list of input fields. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |
| [`booleanInput()`](#method-booleanInput) protected static | Generates a Bootstrap checkbox, switch, or radio. | `BaseHtml` |
| [`getId()`](#method-getId) protected static | Returns the next auto-generated `id` for checkbox and radio labels. | `BaseHtml` |
| <span id="method-setActivePlaceholder"></span>[`setActivePlaceholder()`](/docs/api/yii/helpers/basehtml/index.md#method-setActivePlaceholder) protected static | Generate placeholder from model attribute label. | [`yii\helpers\BaseHtml`](/docs/api/yii/helpers/basehtml/index.md) |

## Method details

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

```php
public static function activeStaticControl(yii\base\Model $model, string $attribute, mixed[] $options = []): string
```

Generates a static form control for the given model attribute.

The `value` option, when present, replaces the attribute value.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$model` | [`yii\base\Model`](/docs/api/yii/base/model/index.md) | Model holding the attribute. |
| `$attribute` | `string` | Attribute name or expression. |
| `$options` | `mixed[]` | Tag attributes, see [`staticControl()`](/docs/extensions/bootstrap6/reference/basehtml/index.md#method-staticControl). |

**Returns**

`string`: Generated HTML.

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

```php
public static function addCssClass(array<yii2\extensions\bootstrap6\TKey, mixed> &$options, mixed[]|string|Stringable|UnitEnum $class): void
```

Adds CSS classes to the options; enum cases are converted to their value (backed) or name (pure).

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$options` | `array<yii2\extensions\bootstrap6\TKey, mixed>` | Tag attributes to modify. |
| `$class` | `mixed[]\|string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php) | Class, or list of classes (keys are kept), each a `string`, an enum case, or a [`Stringable`](https://www.php.net/manual/en/class.stringable.php) value; `null` entries are ignored, and the options are left unchanged when no entry remains. |

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

```php
public static function badge(string|Stringable $label, string|yii2\extensions\bootstrap6\enum\Theme|null $theme = null, mixed[] $options = []): string
```

Generates a badge.

The `encode` option controls whether the label is HTML-encoded (default `true`).

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$label` | `string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php) | Badge content. |
| `$theme` | `string\|`[`yii2\extensions\bootstrap6\enum\Theme`](/docs/extensions/bootstrap6/reference/enum/theme/index.md)`\|null` | Theme color, or `null` for the default color. |
| `$options` | `mixed[]` | Tag attributes. |

**Returns**

`string`: Generated HTML, for example `<span class="badge theme-primary">New</span>`.

**See also**

- <https://getbootstrap.com/docs/6.0/components/badge/>

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

```php
public static function checkboxList(string $name, mixed[]|string|null $selection = null, mixed[] $items = [], mixed[] $options = []): string
```

Generates a list of Bootstrap checkboxes, each wrapped in a `.form-field` element.

Besides the core options (`item`, `itemOptions`, `encode`, `separator`, `tag`, `unselect`, `strict`), the
following options are handled:

- `inline`: `bool`, whether to lay out the items horizontally (`d-flex flex-wrap gap-5` on the container instead
  of `form-group`).
- `itemOptions['wrapperOptions']`: `array`, HTML attributes of each `.form-field` item wrapper, for example
  `form-field-card`.

When `item` is set, the callback renders each item and neither the wrapper nor the `.form-field` element is
added to it.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | Input name; `[]` is appended when missing. |
| `$selection` | `mixed[]\|string\|null` | Selected value or values. |
| `$items` | `mixed[]` | Data items, value => label. |
| `$options` | `mixed[]` | Container attributes and the special options above. |

**Returns**

`string`

**See also**

- <https://getbootstrap.com/docs/6.0/forms/field/#grouped>

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

```php
public static function closeButton(mixed[] $options = []): string
```

Generates a close button with a translated `aria-label`.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$options` | `mixed[]` | Tag attributes. |

**Returns**

`string`: Generated HTML, for example `<button type="button" class="btn-close" aria-label="Close"></button>`.

**See also**

- <https://getbootstrap.com/docs/6.0/components/close-button/>

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

```php
public static function enumValue(class-string<yii2\extensions\bootstrap6\T> $enum, string|yii2\extensions\bootstrap6\T|null $value, string $property, bool $responsive = false): string|null
```

Returns the `string` value of an enum-typed value, validating strings against the enum.

It is the single normalization point of the enum-typed widget properties: widgets call it from `init()` so that
`widget()` and `begin()` fail fast, and again while rendering to obtain the value. Enum cases are converted with
`\UIAwesome\Html\Helper\Enum::normalizeStringValue()`; `null` is returned unchanged.

With `$responsive`, a `string` may also be a space-separated list of values, each optionally prefixed with a
[`Breakpoint`](/docs/extensions/bootstrap6/reference/enum/breakpoint/index.md) value, for example `bottom-start md:top-end`.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$enum` | `class-string<yii2\extensions\bootstrap6\T>` | String-backed enum the value belongs to. |
| `$value` | `string\|yii2\extensions\bootstrap6\T\|null` | Enum case, its `string` value, or `null`. |
| `$property` | `string` | Property name reported in the exception message. |
| `$responsive` | `bool` | Whether to accept breakpoint-prefixed values. |

**Returns**

`string|null`: Value of the enum case, the validated `string`, or `null`.

**Throws**

- [`yii\base\InvalidConfigException`](/docs/api/yii/base/invalidconfigexception/index.md): if `$value` is a `string` that is not a value of `$enum`.

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

```php
public static function error(yii\base\Model $model, string $attribute, mixed[] $options = []): string
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$model` | [`yii\base\Model`](/docs/api/yii/base/model/index.md) | Model holding the attribute. |
| `$attribute` | `string` | Attribute name or expression. |
| `$options` | `mixed[]` | Tag options; the `class` attribute defaults to `invalid-feedback`. |

**Returns**

`string`

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

```php
public static function escapeCssIdentifier(string $identifier): string
```

Escapes a string for use as a CSS identifier in a selector, as `CSS.escape()` does.

Bytes from `0x80` up are kept verbatim, so every non-ASCII character of a UTF-8 string passes through unchanged.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$identifier` | `string` | Raw identifier, such as an element `id` or a class name. |

**Returns**

`string`: Identifier safe to interpolate after `#` or `.`, for example `account\:edit` for `account:edit`.

**See also**

- <https://drafts.csswg.org/cssom/#serialize-an-identifier>

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

```php
public static function radioList(string $name, mixed[]|string|null $selection = null, mixed[] $items = [], mixed[] $options = []): string
```

Generates a list of Bootstrap radios, each wrapped in a `.form-field` element.

Accepts the same options as [`checkboxList()`](/docs/extensions/bootstrap6/reference/basehtml/index.md#method-checkboxList).

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` | Input name. |
| `$selection` | `mixed[]\|string\|null` | Selected value. |
| `$items` | `mixed[]` | Data items, value => label. |
| `$options` | `mixed[]` | Container attributes and the special options of [`checkboxList()`](/docs/extensions/bootstrap6/reference/basehtml/index.md#method-checkboxList). |

**Returns**

`string`

**See also**

- <https://getbootstrap.com/docs/6.0/forms/field/#grouped>

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

```php
public static function staticControl(string $value, mixed[] $options = []): string
```

Generates a read-only plain-text input.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string` | Control value. |
| `$options` | `mixed[]` | Tag attributes. |

**Returns**

`string`: Generated HTML, for example `<input type="text" class="form-control-plaintext" value="x" readonly>`.

**See also**

- <https://getbootstrap.com/docs/6.0/forms/form-control/#readonly-plain-text>

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

```php
public static function theme(mixed[] &$options, string|yii2\extensions\bootstrap6\enum\Theme|null $theme): void
```

Adds the `theme-{value}` class to the options.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$options` | `mixed[]` | Tag attributes to modify. |
| `$theme` | `string\|`[`yii2\extensions\bootstrap6\enum\Theme`](/docs/extensions/bootstrap6/reference/enum/theme/index.md)`\|null` | Theme color, or `null` to leave the options unchanged. |

**Throws**

- [`yii\base\InvalidConfigException`](/docs/api/yii/base/invalidconfigexception/index.md): if `$theme` is a `string` that is not a [`Theme`](/docs/extensions/bootstrap6/reference/enum/theme/index.md) value.

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

```php
protected static function booleanInput(string $type, string $name, bool $checked = false, mixed[] $options = []): string
```

Generates a Bootstrap checkbox, switch, or radio.

Besides the core options (`uncheck`, `label`, `labelOptions`), the following options are handled:

- `switch`: `bool`, checkbox only. Renders
  `<div class="switch"><input type="checkbox" role="switch" switch></div>` instead of the `.check` class.
- `switchOptions`: `array`, HTML attributes of the `.switch` wrapper, for example `theme-success` or `switch-lg`.
- `wrapInput`: `bool`, whether to render the control inside the `<label>` instead of before it.

When `label` is set, the control receives an auto-generated `id` (see [`$autoIdPrefix`](/docs/extensions/bootstrap6/reference/basehtml/index.md#property-autoIdPrefix)) unless one is given,
and the label is rendered as `<label for="id">`. The label is NOT HTML-encoded.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$type` | `string` | Input type, either `checkbox` or `radio`. |
| `$name` | `string` | Input name. |
| `$checked` | `bool` | Whether the input is checked; the `checked` option takes precedence. |
| `$options` | `mixed[]` | Tag attributes and the special options above. |

**Returns**

`string`

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

```php
protected static function getId(): string
```

Returns the next auto-generated `id` for checkbox and radio labels.

**Returns**

`string`