Migration·续2

  • Replaced the Modal component with Dialog. Dialog is built on the native <dialog> element, using showModal() / show() / close() browser APIs. The markup, classes, data attributes, events, CSS variables, and JavaScript API have all changed:
  • Markup: The .modal > .modal-dialog > .modal-content wrapper structure has been replaced by a single <dialog class="dialog"> element. Body sections use .dialog-header, .dialog-body, and .dialog-footer directly 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-dialog and .modal-content wrapper 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 to import { 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 (affects Dialog.getInstance() and Dialog.getOrCreateInstance()).
  • CSS variables: --modal-* → --dialog-*.
  • Backdrop: The .modal-backdrop DOM element and the legacy util/backdrop helper are gone — Dialog uses the native ::backdrop pseudo-element with backdrop-filter: blur() support.
  • Scroll prevention: .modal-open on <body> → .dialog-open on the root (<html>) element, so it pairs with scrollbar-gutter: stable and 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: false or data-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-sheet variant 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-style with a discrete display transition, so the component no longer toggles helper classes to drive the animation:
  • Removed the animation option and data-bs-animation. Add .toast-instant to skip the animation, matching .dialog-instant and .drawer-instant.
  • Removed the .showing class and the deprecated .hide class. Only .show is toggled now. Replace any CSS or tests that depend on them.
  • Toasts no longer get the generic .fade class. The transition lives on .toast itself, tuned with --toast-transition-duration and --toast-transition-timing.
  • isShown() returns false as soon as hide() is called, rather than when the fade-out ends.
  • Alert, tab, tooltip, and popover moved to CSS too, so nothing needs .fade anymore. Each one declares its own transition and its own --bs-{component}-transition-* tokens, as the toast already did. .fade stays 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 .hiding for the length of the transition, then removes the element, so .fade and .show are no longer needed in the markup. Alerts that never had .fade now animate too, which delays closed.bs.alert by the transition. Add .alert-instant to keep the old instant removal.
  • Tab panes fade in on their own. The plugin adds .active and .show in 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.tab now fires after the incoming pane finishes. Add .tab-pane-instant for an instant swap.
  • Tooltips and popovers animate from @starting-style. The plugin no longer adds .fade to the tip. animation: false adds .tooltip-instant or .popover-instant instead, which you can also write in a custom template.
  • 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-wave for the standard loading animation. The old opacity animation moved to .placeholder-pulse. The .placeholder-glow class remains as a compatibility alias for .placeholder-pulse.
  • Collapse animates its size natively. The plugin toggles .show and nothing else. The CSS animates the size with interpolate-size, as the accordion already does:
  • Removed the .collapsing class, and with it the inline height and width the plugin used to write. Replace any CSS, tests, or selectors that depend on either.
  • Browsers without interpolate-size open and close the element at once. Firefox is the one to watch.
  • .collapse now clips the animated axis at all times, so content can no longer spill out of the box. A .collapse-horizontal clips the inline axis instead.
  • shown.bs.collapse and hidden.bs.collapse now 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-parent still 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 -instant class, 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-styled for gradient/shadow depth and .btn-link for 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-icon class for square icon-only buttons with aspect-ratio: 1.
  • Added xs button 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 name attribute on <details> elements, replacing the data-bs-parent approach.
  • The .accordion-button and .accordion-collapse classes have been removed.
  • The expand/collapse icon now uses an .accordion-icon element (typically an SVG) inside the summary, replacing the CSS background-image approach.
  • Open state styling uses details[open] instead of JavaScript-toggled classes.
  • Theme coloring via .theme-* classes on the .accordion wrapper.
  • New modifiers: .accordion-sm for compact padding and type, and .accordion-gap to space items as separate rounded cards (--accordion-gap).
  • Rebuilt close button markup. .btn-close now renders its icon via a CSS mask-image (--btn-close-icon) tinted with background-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 by currentcolor inheritance, and the .btn-close-white class 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-dismissible modifier class. Place a .btn-close directly inside the alert—the alert's flex layout positions it automatically. Remove any .alert-dismissible class from your markup.
  • Restructured cards. The outer border lives on .card. Header and footer keep a divider border only. Use .list-group-flush inside a card—.card-list is gone. Added --card-box-shadow and --card-body-gap tokens. New variant classes: .card-translucent (frosted glass effect) and .card-subtle (themed with subtle backgrounds). Horizontal cards use a new .card-row class. Removed .card-link class. .card-body is now an optional flex column that removes direct-child block margins and uses --card-body-gap for spacing. Add .flex-row for a horizontal body. .card-title and .card-text remain available as project hooks but no longer add styles; .card-subtitle still reduces the gap above the subtitle.
  • Card groups now use container queries. .card-group switches to its attached, equal-width row layout with a @container query instead of a viewport @media query, 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-inline utility to a parent element—or the cards stay stacked.
  • List group horizontal variants now use container queries. The .*:list-group-horizontal classes switch between vertical and horizontal layouts with @container queries instead of viewport @media queries, 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-primary utility pattern with a .theme-* class on the badge. For example, class="badge bg-primary" becomes class="badge theme-primary" for the default solid style. Add .badge-subtle or .badge-outline for 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-link as an interactive element with padding, min-height, and hover background, and explicit .breadcrumb-divider elements as separators between items. An empty .breadcrumb-divider renders a default chevron via a CSS mask-image (--breadcrumb-divider-icon) tinted with background-color: currentcolor; add your own SVG, text, or markup inside it to override. This replaces the v5 --bs-breadcrumb-divider content string on the .breadcrumb-item::before pseudo-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-toggler toggling a .collapse.navbar-collapse region 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-expand breakpoint 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-expand prefix. The v5 .navbar-light / .navbar-dark color-scheme classes have also been removed—set the surface with a background utility such as .bg-1 and let color modes handle light and dark.

Before (v5):

```html

```

After (v6):

```html

```