Migration·续3
- Collapse triggers now use
aria-expandedas the state signal. Bootstrap v6 no longer adds or removes a.collapsedclass on collapse trigger elements. If you styled or queried trigger state with.collapsed, migrate those selectors to[aria-expanded="false"]and open-state selectors to[aria-expanded="true"]. - Removed the Collapse
toggleoption. The constructor now keeps the state your markup declares, instead of flipping it. Droptoggle: falsefrom your config, it is the behavior you already get. If you relied on the oldtoggle: truedefault to change the state on init, call the matching method instead.
```js // v5 new bootstrap.Collapse(el) // opened a closed element new bootstrap.Collapse(el, { toggle: false })
// v6 new bootstrap.Collapse(el).show() new bootstrap.Collapse(el) ```
- Dismiss triggers now find responsive drawers.
data-bs-dismiss="drawer"resolves breakpoint-prefixed drawers such as.lg:drawer, so a close button inside a responsive drawer no longer needsdata-bs-target. Existingdata-bs-targetattributes keep working. - Toggle buttons get a default
aria-pressed. A toggle button needsaria-pressedfor assistive technology to announce it as a toggle, so Bootstrap now adds the attribute to every[data-bs-toggle="button"]that lacks it onDOMContentLoaded, reading.activeto pick the value. Writearia-pressed="false"in your markup so the state is correct before our JavaScript runs. - The navbar no longer computes heights. v5 derived
$navbar-brand-heightand$navbar-brand-padding-yfrom the nav link font size, line height, and padding, so the brand matched the links. v6 drops that math..navbaris a flex container that centers its children, so padding and content set the height.--navbar-brand-padding-yis now.375rem, which matches the nav link block padding, so the brand and the links keep the same click target. A new--navbar-min-heighttoken gives the bar a3.5remfloor, so a default navbar is 56px high. Taller content, such as a logo, still makes the bar grow past the floor. Set--navbar-padding-yor--navbar-min-heightto control the height of the bar. - Navbar toggler icon now uses a CSS mask.
.navbar-toggler-iconrenders viamask-image(--navbar-toggler-icon) tinted withbackground-color: currentcolorinstead of an embeddedbackground-imageSVG. The markup stays an empty<span class="navbar-toggler-icon">, but the icon now inherits the current text color (including dark mode), so the separate light/dark toggler SVGs are no longer needed. - Rebuilt the carousel on CSS scroll snap. The slide engine no longer uses
float+translateXclass juggling or a custom swipe handler—.carousel-inneris now a native horizontal scroll-snap container, so sliding, touch dragging, momentum, and keyboard scrolling come from the browser. The markup is unchanged (.carousel→.carousel-inner→.carousel-item), and the public JavaScript API (next,prev,to,cycle,pause) plus theslide.bs.carousel/slid.bs.carouselevents are preserved. - New capabilities: show multiple slides at once, reveal a “peek” of adjacent slides, gaps, center mode, and variable-width slides—all via CSS custom properties (
--carousel-items,--carousel-items-gap,--carousel-items-peek) and the.carousel-center/.carousel-autovariants. - Removed transitional classes
.carousel-item-start,.carousel-item-end,.carousel-item-next, and.carousel-item-prev, plus the.carousel.pointer-eventhelper—the browser tracks scroll position instead of an.activelayout class. (The active slide still gets.activefor styling.) .carousel-fadeis now a stacked-opacity (grid) crossfade animated with a CSS opacity transition over--bs-carousel-fade-duration(it collapses to an instant swap under reduced motion).- Removed the
touchoption. Because.carousel-inneris a native scroll-snap container, horizontal touch dragging is part of the browser’s native scrolling and is no longer toggled by JavaScript. - Active-slide syncing uses an
IntersectionObserver; as a resultslid.bs.carouselfires when the new slide settles into view, and a multi-slideto()jump may emit intermediateslidevents as it scrolls past. - Renamed the carousel
rideoption toautoplay, and made it a boolean. Autoplay is now strictly opt-in: a carousel only autoplays whenautoplayistrue(set viadata-bs-autoplay="true"). The oldrideoption and its string"carousel"value have been removed, as has theride="true"behavior that started autoplaying only after the first user interaction. data-bs-ride="carousel"→data-bs-autoplay="true"data-bs-ride="true"→data-bs-autoplay="true"(it now autoplays on load like any other autoplaying carousel, instead of waiting for the first interaction)- JavaScript:
new bootstrap.Carousel(el, { ride: 'carousel' })→new bootstrap.Carousel(el, { autoplay: true }) - The auto-initialization-on-load selector changed accordingly from
[data-bs-ride="carousel"]to[data-bs-autoplay="true"]. - Autoplaying carousels now stop when the user interacts with them. Clicking a control or indicator, navigating with the keyboard, or swiping permanently stops autoplay instead of resuming it, respecting the visitor’s intent (WCAG 2.2.2). Previously these interactions kept the carousel cycling.
- New
.carousel-control-play-pausecontrol provides a discoverable, accessible button to pause and resume an autoplaying carousel—the mechanism WCAG 2.2.2 requires (a hover-only pause does not qualify). It renders pause/play icons via CSS masks (--carousel-control-pause-icon/--carousel-control-play-icon), swaps its icon andaria-labelwith state, and can also start autoplay on an otherwise static carousel. - Stacked is now the default carousel layout.
.carouselis a flex column, so prev/next controls, indicators, and any custom content sit in the flow above or below the slides. The old.carousel-stackedclass was removed—it’s now the default, so drop it from your markup. - Overlaid controls now require the
.carousel-overlaymodifier. To overlay the prev/next controls, play/pause button, and indicators on top of the slides (the classic v5 look), add.carousel-overlayto the.carouselelement. Without it, those elements lay out in the flow. - Renamed the control-icon classes
.carousel-control-prev-icon→.carousel-icon-prevand.carousel-control-next-icon→.carousel-icon-next. The icons are now painted withbackground-color: currentcolor, so they inherit the surrounding text color (white on the overlay controls, the button color inside.btn-*). Size them with--bs-carousel-control-icon-width. - Removed
.carousel-captionand its--carousel-caption-*tokens. Compose slide content from your own markup inside.carousel-iteminstead, styling and positioning it with utilities or custom CSS. - Replaced the
wrapoption withends. v5'swrap: true | falseis nowends: "loop" | "wrap" | "stop"(default"loop"). Mapwrap: truetoends: "wrap"(or the new default"loop"for the seamless conveyor effect) andwrap: falsetoends: "stop". Set it viadata-bs-endsor theendsoption. Unknown values fall back to"loop". - Removed the
.carousel-control-prev/.carousel-control-nextbutton classes. The absolute, full-height hover targets are gone. Compose a control from a button (e.g..btn-icon) plusdata-bs-slide="prev"/data-bs-slide="next"and a.carousel-icon-prev/.carousel-icon-nextglyph, placed in the flow or inside.carousel-overlay-controls. - Removed the
.carousel-darkclass. Usedata-bs-theme="dark"on the.carousel(typically alongside.carousel-overlay) for reversed contrast. - Removed v5 carousel tokens that no longer have an equivalent:
--carousel-caption-*,--carousel-control-color,--carousel-control-opacity/--carousel-control-hover-opacity,--carousel-control-icon-filter, and--carousel-transition. Indicator, control, and fade styling now derive from the redesigned--bs-carousel-*tokens listed under CSS variables.
Reboot
- Relocated heading classes (like
.h1) and some type classes (.mark,.small, and.initialism) to Reboot from_type.scss. This avoids a dependency in Sass modules and we like to avoid extending selectors in general. - Split the remaining
_type.scssinto_lists.scssand_blockquote.scss. Update any individual@use "bootstrap/scss/content/type"imports tocontent/listsand/orcontent/blockquoteinstead. - Headings, paragraphs, description lists, and
<legend>now use CSS variables instead of Sass variables. Removed$headings-margin-bottom,$headings-font-family,$headings-font-style,$headings-font-weight,$headings-line-height,$headings-color,$paragraph-margin-bottom,$legend-margin-bottom,$legend-font-size,$legend-font-weight, and$dt-font-weight. Customize the equivalent--heading-*,--paragraph-margin-bottom, and--legend-*CSS variables at runtime instead—see Typography. - Removed
$font-size-baseand--font-size-base. The base body font size is now set directly via--body-font-size(default1rem) in_root.scss. Any component tokens that previously fell back tovar(--font-size-base)(like the accordion) now fall back tovar(--body-font-size)instead. Update custom Sass or CSS that referenced either variable to use--body-font-size. - Heading and
<dt>font-weight now fall back to shared weight tokens (font-weight: var(--heading-font-weight, var(--font-weight-medium)),var(--dt-font-weight, var(--font-weight-bold))) instead of a hardcoded value, so you can override either the component-specific token or the shared one. - Added
--link-underline-offsetto$root-tokens(mirroring$link-underline-offset) for runtime customization of the link underline offset. - Reboot and content spacing—
address, lists,dd,blockquote,pre,figure,caption,kbdpadding, andol/ulpadding-inline-start(now driven by a new--list-padding-xtoken)—now derive from the--spacer-*scale instead of hardcodedremvalues. Visual output is unchanged. - Removed the
::-moz-focus-innerstyles, as the pseudo selector is deprecated in Firefox. - Removed
text-transform: nonefrombuttonandselectelements, as Firefox no longer incorrectly inherits text-transform. - Added
accent-color: var(--primary-base)on:root, which applies the primary theme color to native form controls (checkboxes, radios, range inputs, progress bars) globally. - Reboot now sets
color-scheme: light darkon everyiframe. This keeps an embed transparent when you force a theme withdata-bs-theme. Remove any v5 workaround like[data-bs-theme="dark"] { color-scheme: unset; }. v6 resolves its color tokens withlight-dark(), which readscolor-scheme. Anunsetthere turns off dark mode for the whole subtree. For a third-party embed with no dark mode, add the new.color-scheme-lightutility to that one iframe instead—see Reboot.
