Migration·续2
- Replaced the Modal component with Dialog. Dialog is built on the native
<dialog>element, usingshowModal()/show()/close()browser APIs. The markup, classes, data attributes, events, CSS variables, and JavaScript API have all changed: - Markup: The
.modal>.modal-dialog>.modal-contentwrapper structure has been replaced by a single<dialog class="dialog">element. Body sections use.dialog-header,.dialog-body, and.dialog-footerdirectly inside the<dialog>. - CSS classes:
.modal→.dialog,.modal-header→.dialog-header,.modal-body→.dialog-body,.modal-footer→.dialog-footer,.modal-title→.dialog-title. The.modal-dialogand.modal-contentwrapper classes have been removed entirely. - Sizes:
.modal-sm→.dialog-sm,.modal-lg→.dialog-lg,.modal-xl→.dialog-xl,.modal-fullscreen→.dialog-fullscreen. - Data attributes:
data-bs-toggle="modal"→data-bs-toggle="dialog",data-bs-dismiss="modal"→data-bs-dismiss="dialog". - JavaScript:
Modal→Dialog— update imports toimport { Dialog } from 'bootstrap'. - Events:
show.bs.modal→show.bs.dialog,shown.bs.modal→shown.bs.dialog,hide.bs.modal→hide.bs.dialog,hidden.bs.modal→hidden.bs.dialog,hidePrevented.bs.modal→hidePrevented.bs.dialog. - Data key:
bs.modal→bs.dialog(affectsDialog.getInstance()andDialog.getOrCreateInstance()). - CSS variables:
--modal-*→--dialog-*. - Backdrop: The
.modal-backdropDOM element and the legacyutil/backdrophelper are gone — Dialog uses the native::backdroppseudo-element withbackdrop-filter: blur()support. - Scroll prevention:
.modal-openon<body>→.dialog-openon the root (<html>) element, so it pairs withscrollbar-gutter: stableand the page doesn't shift when a dialog opens. - New variant classes:
.dialog-slide-up,.dialog-slide-down(slide animations),.dialog-instant(no animation),.dialog-static(static backdrop bounce),.dialog-nonmodal(non-modal positioning),.dialog-scrollable. - Non-modal support: Set
modal: falseordata-bs-modal="false"for non-modal dialogs. - Dialog swapping: Triggers inside an open dialog can open a new dialog and close the current one automatically.
- See the Dialog docs for full details.
- Offcanvas renamed to Drawer. All class names, data attributes, events, CSS variables, and JavaScript APIs have been renamed:
- Element:
<div class="offcanvas">→<dialog class="drawer">. Drawer requires the native<dialog>element. - CSS classes:
.offcanvas→.drawer,.offcanvas-start→.drawer-start,.offcanvas-header→.drawer-header, etc. - Data attributes:
data-bs-toggle="offcanvas"→data-bs-toggle="drawer",data-bs-dismiss="offcanvas"→data-bs-dismiss="drawer" - JavaScript:
Offcanvas→Drawer - Events:
show.bs.offcanvas→show.bs.drawer,hidePrevented.bs.offcanvas→hidePrevented.bs.drawer, etc. - CSS variables:
--offcanvas-*→--drawer-* - Sass:
$zindex-offcanvas→$zindex-drawer - New
.drawer-sheetvariant for flush-to-edge panels with no inset, border-radius, or shadow. - Swipe-to-dismiss gesture support on touch devices for Drawer components. Drawers automatically detect their placement and dismiss on the appropriate swipe direction.
- Dialog and Drawer share
DialogBase— the show/hide/toggle lifecycle, keyboard handling, backdrop clicks, and static backdrop bounce are consolidated in a shared base class. - Toast transitions moved to CSS. The fade now uses
@starting-stylewith a discretedisplaytransition, so the component no longer toggles helper classes to drive the animation: - Removed the
animationoption anddata-bs-animation. Add.toast-instantto skip the animation, matching.dialog-instantand.drawer-instant. - Removed the
.showingclass and the deprecated.hideclass. Only.showis toggled now. Replace any CSS or tests that depend on them. - Toasts no longer get the generic
.fadeclass. The transition lives on.toastitself, tuned with--toast-transition-durationand--toast-transition-timing. isShown()returnsfalseas soon ashide()is called, rather than when the fade-out ends.- Alert, tab, tooltip, and popover moved to CSS too, so nothing needs
.fadeanymore. Each one declares its own transition and its own--bs-{component}-transition-*tokens, as the toast already did..fadestays as a generic class for your own markup, and it does no harm where you leave it, but no component depends on it: - Alerts fade out on their own.
close()adds.hidingfor the length of the transition, then removes the element, so.fadeand.showare no longer needed in the markup. Alerts that never had.fadenow animate too, which delaysclosed.bs.alertby the transition. Add.alert-instantto keep the old instant removal. - Tab panes fade in on their own. The plugin adds
.activeand.showin the same frame instead of sequencing them, and the CSS animates from@starting-style. The pane you leave hides at once, since two in-flow panes cannot cross-fade.shown.bs.tabnow fires after the incoming pane finishes. Add.tab-pane-instantfor an instant swap. - Tooltips and popovers animate from
@starting-style. The plugin no longer adds.fadeto the tip.animation: falseadds.tooltip-instantor.popover-instantinstead, which you can also write in a customtemplate. - Hover and focus tooltips stay open on the tip. In v5 the tooltip hid as soon as the pointer left the trigger. v6 keeps it open while the pointer or focus is on the tip itself, so links inside the tooltip are reachable (WCAG 1.4.13). Press Escape or leave both the trigger and the tip to hide it. See Tooltips.
- Placeholder loading animations now favor shimmer. Use
.placeholder-wavefor the standard loading animation. The old opacity animation moved to.placeholder-pulse. The.placeholder-glowclass remains as a compatibility alias for.placeholder-pulse. - Collapse animates its size natively. The plugin toggles
.showand nothing else. The CSS animates the size withinterpolate-size, as the accordion already does: - Removed the
.collapsingclass, and with it the inlineheightandwidththe plugin used to write. Replace any CSS, tests, or selectors that depend on either. - Browsers without
interpolate-sizeopen and close the element at once. Firefox is the one to watch. .collapsenow clips the animated axis at all times, so content can no longer spill out of the box. A.collapse-horizontalclips the inline axis instead.shown.bs.collapseandhidden.bs.collapsenow fire off the CSS transition, tuned with--bs-transition-collapse-property,--bs-transition-collapse-duration, and--bs-transition-collapse-timing.- A trigger that targets several collapses under one
data-bs-parentstill opens them together. The parent only closes collapses that the trigger does not target. - Component JavaScript reads the computed transition duration. Alert, collapse, tab, tooltip, and popover no longer look for a class to decide whether to wait for a transition, as the menu already did. A zero duration—from
.transition-none, an-instantclass, reduced motion, or$enable-transitions: false—resolves the promise and fires the event at once. - Reworked button variants. The v5 per-color classes like
.btn-primary,.btn-outline-primary,.btn-secondary, etc. are replaced by a composition of variant + theme classes on the same element: .btn-primary→class="btn-solid theme-primary".btn-outline-primary→class="btn-outline theme-primary"- New variant classes:
.btn-solid,.btn-outline,.btn-subtle,.btn-text, plus.btn-styledfor gradient/shadow depth and.btn-linkfor link-style buttons. - Color is applied via
.theme-*utility classes (e.g.,.theme-primary,.theme-danger,.theme-success) rather than being baked into each button class. - Shared sizing tokens: Buttons and inputs now share
--btn-input-*CSS variables for consistent sizing. - New
.btn-iconclass for square icon-only buttons withaspect-ratio: 1. - Added
xsbutton size (.btn-xs). - Rebuilt accordion on native
<details>/<summary>. The markup structure has fundamentally changed: - v5:
.accordion-item>.accordion-header>button.accordion-button+.accordion-collapse>.accordion-body, controlled by the Collapse JavaScript plugin. - v6:
<details class="accordion-item">><summary class="accordion-header">+<div class="accordion-body">, using the browser’s native disclosure widget. No JavaScript dependency for basic open/close behavior. - Exclusive accordion groups (only one item open) are handled via the HTML
nameattribute on<details>elements, replacing thedata-bs-parentapproach. - The
.accordion-buttonand.accordion-collapseclasses have been removed. - The expand/collapse icon now uses an
.accordion-iconelement (typically an SVG) inside the summary, replacing the CSSbackground-imageapproach. - Open state styling uses
details[open]instead of JavaScript-toggled classes. - Theme coloring via
.theme-*classes on the.accordionwrapper. - New modifiers:
.accordion-smfor compact padding and type, and.accordion-gapto space items as separate rounded cards (--accordion-gap). - Rebuilt close button markup.
.btn-closenow renders its icon via a CSSmask-image(--btn-close-icon) tinted withbackground-color: currentcolor, so the button is self-contained—no child<svg>is required. The filter-based dark mode approach ($btn-close-white-filter) has been replaced bycurrentcolorinheritance, and the.btn-close-whiteclass has been removed. On a dark themed surface, the icon now inherits the contrast color automatically. - Removed
.alert-dismissible. Dismissible alerts no longer require the.alert-dismissiblemodifier class. Place a.btn-closedirectly inside the alert—the alert's flex layout positions it automatically. Remove any.alert-dismissibleclass from your markup. - Restructured cards. The outer border lives on
.card. Header and footer keep a divider border only. Use.list-group-flushinside a card—.card-listis gone. Added--card-box-shadowand--card-body-gaptokens. New variant classes:.card-translucent(frosted glass effect) and.card-subtle(themed with subtle backgrounds). Horizontal cards use a new.card-rowclass. Removed.card-linkclass..card-bodyis now an optional flex column that removes direct-child block margins and uses--card-body-gapfor spacing. Add.flex-rowfor a horizontal body..card-titleand.card-textremain available as project hooks but no longer add styles;.card-subtitlestill reduces the gap above the subtitle. - Card groups now use container queries.
.card-groupswitches to its attached, equal-width row layout with a@containerquery instead of a viewport@mediaquery, so it responds to the width of a parent query container rather than the viewport. Wrap the card group in a query container—e.g. add the.contains-inlineutility to a parent element—or the cards stay stacked. - List group horizontal variants now use container queries. The
.*:list-group-horizontalclasses switch between vertical and horizontal layouts with@containerqueries instead of viewport@mediaqueries, responding to a parent query container rather than the viewport. Wrap the list group in a query container (e.g..contains-inline) for the responsive variants to take effect. - Reworked badge variants. Replace the v5
.bg-primaryutility pattern with a.theme-*class on the badge. For example,class="badge bg-primary"becomesclass="badge theme-primary"for the default solid style. Add.badge-subtleor.badge-outlinefor the other variants. - Added theme variant support to pagination. Add a
.theme-{color}class to.pagination(e.g.,.pagination.theme-primary) to color links, hover, focus, and the active page item with a semantic theme color, matching the pattern already used by alerts and accordions. - Updated breadcrumb markup. Breadcrumbs now use
.breadcrumb-linkas an interactive element with padding, min-height, and hover background, and explicit.breadcrumb-dividerelements as separators between items. An empty.breadcrumb-dividerrenders a default chevron via a CSSmask-image(--breadcrumb-divider-icon) tinted withbackground-color: currentcolor; add your own SVG, text, or markup inside it to override. This replaces the v5--bs-breadcrumb-dividercontent string on the.breadcrumb-item::beforepseudo-element. The default bottom margin is gone (v5 used$spacer/1rem). Add a spacer utility if you still want space below the trail. - Navbar responsive collapsing now uses the Drawer, not Collapse. The v5 collapsible navbar—a
.navbar-togglertoggling a.collapse.navbar-collapseregion through the Collapse plugin—has been replaced by the Drawer. On narrow viewports the navigation slides in as a<dialog class="drawer">; from your.{breakpoint}:navbar-expandbreakpoint up it lays out inline as before. Three things change: the toggler targets a drawer (data-bs-toggle="drawer") instead of a collapse; the collapsible region becomes a<dialog class="drawer">with.drawer-header/.drawer-body; and the.navbar-expand-{bp}infix becomes the.{bp}:navbar-expandprefix. The v5.navbar-light/.navbar-darkcolor-scheme classes have also been removed—set the surface with a background utility such as.bg-1and let color modes handle light and dark.
Before (v5):
```html
```
After (v6):
```html
```
