# Bootstrap 6

> Bootstrap 6 widgets, forms, and asset bundles for Yii2

**Bootstrap 6 widgets, forms, and asset bundles for Yii2**

_ESM-only Bootstrap bundle installed through Foxy, plugins loaded without a global_

:::caution[Important]
This package pins Bootstrap `6.0.0-alpha.1`. Its classes, markup, and plugin options may change before beta.
Supported browsers start at Chrome/Edge 130, Firefox 132, and Safari 18.
:::

## Features

![Feature Overview](/docs/_astro/features.CKot2fpa.svg)

## Quick start

### Installation

Select the native manager in the application's root `composer.json`:

```json
{
  "config": {
    "foxy": {
      "manager": "native"
    }
  }
}
```

Then install the extension:

```bash
composer config allow-plugins.php-forge/foxy true
composer require php-forge/foxy:^0.4 yii2-extensions/bootstrap6:^0.1
```

Foxy's native manager installs the frontend assets with PHP and `ext-zlib`; Node.js is unnecessary. Configure it
in the application's root `composer.json` before requiring the extension. Its default install directory is
`node_modules`. Point `@npm` to that actual directory; use `@app/node_modules` only when the application base path
is the Composer project root. For Yii2 `2.0.x`, native installation into `vendor/npm` matches its default alias.
See [installation](/docs/extensions/bootstrap6/installation/index.md) for the complete configuration and optional package managers.

### Basic usage

Place this in a Yii view. The button opens a native dialog with a title, content, and a working close action:

```php
use yii2\extensions\bootstrap6\{Dialog, Html};
use yii2\extensions\bootstrap6\enum\DialogSize;

Dialog::begin(
    [
        'title' => 'Welcome to your next project',
        'size' => DialogSize::LG,
        'toggleButton' => ['label' => 'Preview welcome'],
        'footer' => Html::button(
            'Start exploring',
            [
                'class' => 'btn-solid theme-primary',
                'data' => ['bs-dismiss' => 'dialog'],
            ]
        ),
    ],
);

echo '<p class="fs-5">Build clear interfaces with <strong>Yii2 and Bootstrap 6</strong>.</p>';

Dialog::end();
```

Widgets load their CSS and JavaScript on demand. The JavaScript bundle uses `type="module"` and exposes no
`window.bootstrap` by default; use the registered bundle's `importJs()` helper for custom plugin code. Titles and
labels are encoded by default, while body and footer content require encoding when they contain user data.

## Documentation

Practical guides and complete examples, with API details generated from PHPDoc.

- 📚 [Installation Guide](/docs/extensions/bootstrap6/installation/index.md): packages, aliases, assets, and CDN delivery.
- ⚙️ [Configuration Guide](/docs/extensions/bootstrap6/configuration/index.md): practical choices for plugins, items, forms, and icons.
- 💡 [Usage Examples](/docs/extensions/bootstrap6/examples/index.md): widget gallery and complete view recipes.
- 🔄 [Migration from Bootstrap 5](/docs/extensions/bootstrap6/migration/index.md)
- 🧪 [Testing Guide](/docs/extensions/bootstrap6/testing/index.md)
- 📖 [Generated API Reference](https://yii2-framework.github.io/docs/extensions/bootstrap6/reference/)

## AI assistance

AI agents: read <https://yii2-framework.github.io/docs/llms.txt>, the index of the documentation site, and fetch the
Markdown version of a page by appending `index.md` to its URL, for example
<https://yii2-framework.github.io/docs/extensions/bootstrap6/installation/index.md>. For the Yii conventions this
package builds on, install the
[`yii2-framework` agent skill](https://github.com/yii2-framework/docs/blob/main/skills/yii2-framework/SKILL.md) with
`npx skills add yii2-framework/docs --skill yii2-framework`.

- 🤖 [yii2-bootstrap6-widgets skill](/docs/extensions/bootstrap6/agents/index.md): installation for Claude Code, Codex, and OpenCode.

If the hosted sources are unavailable, use the repository guides and locally available skills.

## Our social networks

[Follow on X](https://x.com/Terabytesoftw)

## License

[License](https://github.com/yii2-extensions/bootstrap6/blob/main/LICENSE)

## Package

- Source code and issues: [yii2-extensions/bootstrap6](https://github.com/yii2-extensions/bootstrap6). Star the repository if the package is useful to you.
- Composer package: [yii2-extensions/bootstrap6](https://packagist.org/packages/yii2-extensions/bootstrap6).
- Changelog: [CHANGELOG.md](https://github.com/yii2-extensions/bootstrap6/blob/main/CHANGELOG.md).