Migration·续1
JavaScript
show(),hide(),toggle(), andclose()now return a promise. The promise resolves when the transition ends, so you canawaitthese methods instead of listening for ashown.bs.*orhidden.bs.*event. In v5 they returnedundefined. The events still fire, so existing code keeps working. This covers Alert, Collapse, Combobox, Datepicker, Dialog, Drawer, Menu, Popover, Tab, Toast, and Tooltip. Carousel’snext(),prev(), andto()are unchanged.
Before (v5): ```js myCollapseEl.addEventListener('shown.bs.collapse', () => { // Runs once the collapsible area is expanded })
collapse.show() ```
After (v6):
js
await collapse.show()
// The collapsible area is now expanded
The promise resolves with no value, and it resolves even when the call does nothing — for example when the component is already open or a listener prevents the show.bs.* event. Check the component state yourself if you need to know whether it changed.
- Bootstrap’s JavaScript is now ESM-only. We no longer ship UMD bundles. All dist files (
bootstrap.js,bootstrap.bundle.js, and their minified versions) are native ES modules. The loading model changed, and several component APIs changed as listed below. - CDN
<script>tags must addtype="module":html <script type="module" src="bootstrap.bundle.min.js"></script> - In v5, the UMD bundle automatically created a
window.bootstrapglobal. ES modules don’t do this, so there is no longer abootstrapglobal object. If you called plugin APIs through the global namespace, you must update to explicit imports:
Before (v5):
js
const tooltip = bootstrap.Tooltip.getOrCreateInstance(el)
After (v6):
js
import { Tooltip } from './bootstrap.bundle.min.js'
const tooltip = Tooltip.getOrCreateInstance(el)
- Data API initialization still runs automatically. Add type="module" to the script tag. You must also apply the component and data attribute renames in this guide.
- For modern ESM-based bundlers (Vite, Webpack 5, Parcel 2, Rolldown, etc.), import { Tooltip } from 'bootstrap' still works and supports tree shaking. Install @floating-ui/dom for positioned components and vanilla-calendar-pro for Datepicker. Projects that use CommonJS require() calls must change to ESM import syntax.
- The bootstrap.bundle.js files include Floating UI and Vanilla Calendar Pro. The standalone bootstrap.js files leave these peer dependencies external, so direct browser loading requires an import map.
- Bootstrap’s JavaScript source is now TypeScript. The js/src files use the .ts extension. The package ships built-in type declarations in js/dist/*.d.ts, so you no longer need @types/bootstrap. Deep .js imports still work: bootstrap/js/src/alert.js now resolves to the compiled file in js/dist. To import the raw TypeScript source, use bootstrap/js/src/alert.ts.
- We now build with Rolldown instead of Rollup and Babel. This only affects you if you build Bootstrap from source. Rolldown strips the TypeScript types and lowers the syntax itself, so Babel is gone, along with .babelrc.mjs and the @rollup/plugin-* packages. The published files in dist/ and js/dist/ are unchanged in format. If you bundle Bootstrap in your own project, keep using whatever bundler you prefer — Rollup is still a fine choice, and import { Tooltip } from 'bootstrap' works the same way. See the contribute guide for details.
- Tab now throws when its element has no tab-panel ancestor. In v5 the constructor returned early and gave you an inert instance, which hid the markup error. Wrap your tab triggers in a .list-group, .nav, or [role="tablist"] container, as the Nav docs show.
- Removed the separate bootstrap.esm.js and bootstrap.esm.min.js files — bootstrap.js is now the ESM entry point.
- Removed js/index.umd.js entry point.
- Removed jQuery support and the js-test-jquery test target.
- Removed the internal util/backdrop, util/focustrap, and util/scrollbar helpers. They’re obsolete now that Dialog and Drawer build on the native <dialog> element—the browser provides the backdrop (::backdrop), focus trap, and an inert top layer, and the body scroll-lock is handled in CSS (:root.dialog-open with scrollbar-gutter: stable). If you imported any of these modules directly from bootstrap/js/src/util/, they’re gone.
- Replaced the Dropdown component with Menu. All .dropdown-* classes are now .menu-* classes, and data-bs-toggle="dropdown" is now data-bs-toggle="menu". See the Menu docs for full details.
- Menu shown.bs.menu and hidden.bs.menu now fire after the CSS transition finishes, rather than synchronously when show() / hide() are called—matching Dialog and Drawer. The menu also stays positioned in the DOM through its closing transition instead of being torn down immediately. Move any logic that assumed the old synchronous timing (or that the menu was removed the instant hide() returned) into the shown / hidden event handlers.
- Renamed CSS classes: .dropdown-menu to .menu, .dropdown-item to .menu-item, .dropdown-divider to .menu-divider, .dropdown-header to .menu-header, .dropdown-submenu to .submenu.
- Removed directional wrappers: .dropstart, .dropend, and .dropup. Use data-bs-placement to control direction instead (for example, .dropup becomes data-bs-placement="top").
- Removed the .dropdown-toggle class — menu toggles no longer require a toggle class.
- Removed the .dropdown wrapper — no wrapper element is required. The toggle and .menu are direct siblings.
- Simplified markup from <ul><li><a class="dropdown-item"> to a flat <div class="menu"><a class="menu-item"> structure.
- Removed .dropdown-toggle-split — button group border radius for split menus is now handled automatically via :has(+ .menu).
- Renamed the JavaScript export from Dropdown to Menu — update imports to import { Menu } from 'bootstrap'.
- Renamed events: show.bs.dropdown to show.bs.menu, shown.bs.dropdown to shown.bs.menu, hide.bs.dropdown to hide.bs.menu, hidden.bs.dropdown to hidden.bs.menu.
- Renamed the data key from bs.dropdown to bs.menu (affects Menu.getInstance() and Menu.getOrCreateInstance()).
- Added new Combobox component. A searchable select built on top of Menu, with single and multi-select support. See the Combobox docs.
- Replaced Popper.js (@popperjs/core) with Floating UI (@floating-ui/dom) for menu, tooltip, and popover positioning. The popperConfig option on Tooltip, Popover, and Menu (formerly Dropdown) has been renamed to floatingConfig. Update any custom positioning configuration accordingly.
- Added Vanilla Calendar Pro (vanilla-calendar-pro) as a peer dependency for the new Datepicker component. Popup datepickers close on outside interaction, on <kbd>Escape</kbd>, or when focus leaves the input and calendar.
- Removed the jspm configuration from package.json.
- Added "sideEffects" metadata to package.json to enable tree shaking in bundlers while preserving the Data API event listeners that Bootstrap’s plugins register at the top level.
- Added "exports" map to package.json for explicit subpath access to source, dist, and Sass files.
- Rewrote ScrollSpy to be deterministic and IntersectionObserver-native. Detection is now driven entirely by an activation line (no scroll-position polling), so the active section is always the one you’re reading, with stable behavior at the top and bottom of the container.
- Removed the long-deprecated offset and method options (deprecated since v5.1.3). They are no longer parsed.
- Added the topMargin option (default 12%) to position the activation line as a friendly % or px value from the top of the scroll root (for example 96px to sit below a sticky navbar).
- rootMargin is now an advanced override that takes precedence over topMargin and is passed straight to the observer; its default is null (the activation line is derived from topMargin).
- Changed the default threshold from [0.1, 0.5, 1] to [0].
- With smoothScroll enabled, clicking a link now restores the URL hash (via history.replaceState) and moves focus to the target section once the scroll settles, improving keyboard and assistive-technology navigation.
- Target ids are resolved with getElementById, so ids containing dots, colons, slashes, or percent-encoded characters now work without manual escaping.
