Migrating to v5
Track and review changes to the Bootstrap source files, documentation, and components to help you migrate from v4 to v5.
- Dropped jQuery.
- Upgraded from Popper v1.x to Popper v2.x.
- Replaced Libsass with Dart Sass as our Sass compiler given Libsass was deprecated.
- Migrated from Jekyll to Hugo for building our documentation
- Dropped Internet Explorer 10 and 11
- Dropped Microsoft Edge < 16 (Legacy Edge)
- Dropped Firefox < 60
- Dropped Safari < 12
- Dropped iOS Safari < 12
- Dropped Chrome < 60
- Redesigned homepage, docs layout, and footer.
- Added new Parcel guide.
- Added new Customize section, replacing v4’s Theming page, with new details on Sass, global configuration options, color schemes, CSS variables, and more.
- Reorganized all form documentation into new Forms section, breaking apart the content into more focused pages.
- Similarly, updated the Layout section, to flesh out grid content more clearly.
- Renamed “Navs” component page to “Navs & Tabs”.
- Renamed “Checks” page to “Checks & radios”.
- Redesigned the navbar and added a new subnav to make it easier to get around our sites and docs versions.
- Added new keyboard shortcut for the search field: Ctrl + /.
We’ve ditched the default Sass map merges to make it easier to remove redundant values. Keep in mind you now have to define all values in the Sass maps like
$theme-colors. Check out how to deal with Sass maps.
color-yiq()function and related variables to
color-contrast()as it’s no longer related to YIQ colorspace. See #30168.
$yiq-contrasted-thresholdis renamed to
$yiq-text-lightare respectively renamed to
Breaking Media query mixins parameters have changed for a more logical approach.
media-breakpoint-down()uses the breakpoint itself instead of the next breakpoint (e.g.,
media-breakpoint-down(md)targets viewports smaller than
- Similarly, the second parameter in
media-breakpoint-between()also uses the breakpoint itself instead of the next breakpoint (e.g.,
media-between(sm, lg)instead of
media-breakpoint-between(sm, md)targets viewports between
Breaking Removed print styles and
$enable-print-stylesvariable. Print display classes are still around. See #28339.
gray()functions in favor of variables. See #29083.
color-level()and now accepts any color you want instead of only
$theme-colorcolors. See #29083 Watch out:
color-level()was later on dropped in
Breaking Removed the
bg-gradient-variant()mixin. Use the
.bg-gradientclass to add gradients to elements instead of the generated
Breaking Removed previously deprecated mixins:
text-hide()(also dropped the associated utility class,
shift-color()to avoid collision with Sass’s own color scaling function.
box-shadowmixins now allow
nullvalues and drop
nonefrom multiple arguments. See #30394.
border-radius()mixin now has a default value.
The color system which worked with
$theme-color-intervalwas removed in favor of a new color system. All
darken()functions in our codebase are replaced by
shade-color(). These functions will mix the color with either white or black instead of changing its lightness by a fixed amount. The
shift-color()will either tint or shade a color depending on whether its weight parameter is positive or negative. See #30622 for more details.
Added new tints and shades for every color, providing nine separate colors for each base color, as new Sass variables.
Improved color contrast. Bumped color contrast ratio from 3:1 to 4.5:1 and updated blue, green, cyan, and pink colors to ensure WCAG 2.1 AA contrast. Also changed our color contrast color from
To support our color system, we’ve added new custom
shade-color()functions to mix our colors appropriately.
New breakpoint! Added new
1400pxand up. No changes to all other breakpoints.
Improved gutters. Gutters are now set in rems, and are narrower than v4 (
1.5rem, or about
24px, down from
30px). This aligns our grid system’s gutters with our spacing utilities.
- Added new gutter class (
.gy-*) to control horizontal/vertical gutters, horizontal gutters, and vertical gutters.
- Breaking Renamed
.g-0to match new gutter utilities.
- Added new gutter class (
Columns no longer have
position: relativeapplied, so you may have to add
.position-relativeto some elements to restore that behavior.
Breaking Dropped several
.order-*classes that often went unused. We now only provide
.order-5out of the box.
bootstrap-grid.cssnow only applies
box-sizing: border-boxto the column instead of resetting the global box-sizing. This way, our grid styles can be used in more places without interference.
$enable-grid-classesno longer disables the generation of container classes anymore. See #29146.
make-colmixin to default to equal columns without a specified size.
Content, Reboot, etc
RFS is now enabled by default. Headings using the
font-size()mixin will automatically adjust their
font-sizeto scale with the viewport. This feature was previously opt-in with v4.
Breaking Overhauled our display typography to replace our
$display-*variables and with a
$display-font-sizesSass map. Also removed the individual
$display-*-weightvariables for a single
Added two new
Links are underlined by default (not just on hover), unless they’re part of specific components.
Redesigned tables to refresh their styles and rebuild them with CSS variables for more control over styling.
Breaking Nested tables do not inherit styles anymore.
.thead-darkare dropped in favor of the
.table-*variant classes which can be used for all table elements (
table-row-variant()mixin is renamed to
table-variant()and accepts only 2 parameters:
$color(color name) and
$value(color code). The border color and accent colors are automatically calculated based on the table factor variables.
Split table cell padding variables into
.pre-scrollableclass. See #29135
.text-*utilities do not add hover and focus states to links anymore.
.link-*helper classes can be used instead. See #29267
.text-justifyclass. See #29793
Reset default horizontal
<ol>elements from browser default
$enable-smooth-scroll, which applies
scroll-behavior: smoothglobally—except for users asking for reduced motion through
prefers-reduced-motionmedia query. See #31877
- Horizontal direction specific variables, utilities, and mixins have all been renamed to use logical properties like those found in flexbox layouts—e.g.,
endin lieu of
Added new floating forms! We’ve promoted the Floating labels example to fully supported form components. See the new Floating labels page.
Breaking Consolidated native and custom form elements. Checkboxes, radios, selects, and other inputs that had native and custom classes in v4 have been consolidated. Now nearly all our form elements are entirely custom, most without the need for custom HTML.
.form-filehave been replaced by custom styles on top of
- Dropped native
.input-group-prepend. You can now just add buttons and
.input-group-textas direct children of the input groups.
The longstanding Missing border radius on input group with validation feedback bug is finally fixed by adding an additional
.has-validationclass to input groups with validation.
Breaking Dropped form-specific layout classes for our grid system. Use our grid and utilities instead of
Breaking Form labels now require
.form-textno longer sets
display, allowing you to create inline or block help text as you wish just by changing the HTML element.
Validation icons are no longer applied to
Rearranged source Sass files under
scss/forms/, including input group styles.
paddingvalues for alerts, breadcrumbs, cards, dropdowns, list groups, modals, popovers, and tooltips to be based on our
$spacervariable. See #30564.
- Added new accordion component.
Alerts now have examples with icons.
Removed custom styles for
<hr>s in each alert since they already use
Breaking Dropped all
.badge-*color classes for background utilities (e.g., use
Breaking Removed hover and focus styles for
Increased default padding for badges from
Simplified the default appearance of breadcrumbs by removing
Added new CSS custom property
--bs-breadcrumb-dividerfor easy customization without needing to recompile CSS.
<input>, and pair it with any
.btnclasses on the
<label>. See #30650. The docs for this has moved from our Buttons page to the new Forms section.
.btn-blockfor utilities. Instead of using
.btn, wrap your buttons with
.gap-*utility to space them as needed. Switch to responsive classes for even more control over them. Read the docs for some examples.
button-outline-variant()mixins to support additional parameters.
Updated buttons to ensure increased contrast on hover and active states.
Disabled buttons now have
.card-deckin favor of our grid. Wrap your cards in column classes and add a parent
.row-cols-*container to recreate card decks (but with more control over responsive alignment).
.card-columnsin favor of Masonry. See #28922.
Breaking Replaced the
.cardbased accordion with a new Accordion component.
.carousel-darkvariant for dark text, controls, and indicators (great for lighter backgrounds).
Replaced chevron icons for carousel controls with new SVGs from Bootstrap Icons.
.btn-closefor a less generic name.
Close buttons now use a
background-image(embedded SVG) instead of a
×in the HTML, allowing for easier customization without the need to touch your markup.
.btn-close-whitevariant that uses
filter: invert(1)to enable higher contrast dismiss icons against darker backgrounds.
- Removed scroll anchoring for accordions.
.dropdown-menu-darkvariant and associated variables for on-demand dark dropdowns.
Added new variable for
Darkened the dropdown divider for improved contrast.
Breaking All the events for the dropdown are now triggered on the dropdown toggle button and then bubbled up to the parent element.
Dropdown menus now have a
data-bs-popper="static"attribute set when the positioning of the dropdown is static and
flipoption for dropdown plugin in favor of native Popper configuration. You can now disable the flipping behavior by passing an empty array for
fallbackPlacementsoption in flip modifier.
Dropdown menus can now be clickable with a new
autoCloseoption to handle the auto close behavior. You can use this option to accept the click inside or outside the dropdown menu to make it interactive.
Dropdowns now support
.dropdown-items wrapped in
- Breaking Dropped the jumbotron component as it can be replicated with utilities. See our new Jumbotron example for a demo.
- Added new
.list-group-numberedmodifier to list groups.
Navs and tabs
- Added new
- Breaking Navbars now require a container within (to drastically simplify spacing requirements and CSS required).
- Added the new offcanvas component.
Pagination links now have customizable
margin-leftthat are dynamically rounded on all corners when separated from one another.
transitions to pagination links.
.popover-arrowin our default popover template.
Spinners now honor
prefers-reduced-motion: reduceby slowing down animations. See #31882.
Improved spinner vertical alignment.
Changed default toast duration to 5 seconds.
overflow: hiddenfrom toasts and replaced with proper
.tooltip-arrowin our default tooltip template.
Breaking The default value for the
fallbackPlacementsis changed to
['top', 'right', 'bottom', 'left']for better placement of popper elements.
Breaking Renamed several utilities to use logical property names instead of directional names with the addition of RTL support:
Breaking Disabled negative margins by default.
.bg-bodyclass for quickly setting the
<body>’s background to additional elements.
Added new position utilities for
left. Values include
100%for each property.
.translate-middle-yutilities to horizontally or vertically center absolute/fixed positioned elements.
.text-hideas it’s an antiquated method for hiding text that shouldn’t be used anymore.
font-sizeutilities (with RFS enabled). These use the same scale as HTML’s default headings (1-6, large to small), and can be modified via Sass map.
.fw-*for brevity and consistency.
.fst-*for brevity and consistency.
.d-gridto display utilities and new
.gap) for CSS Grid and flexbox layouts.
rounded-lg, and introduced a new scale of classes,
.rounded-3. See #31687.
.lh-lg. See here.
.d-noneutility in our CSS to give it more weight over other display utilities.
.visually-hidden-focusablehelper to also work on containers, using
Breaking Responsive embed helpers have been renamed to ratio helpers with new class names and improved behaviors, as well as a helpful CSS variable.
- Classes have been renamed to change
xin the aspect ratio. For example,
- We’ve dropped the
.embed-responsive-itemand element group selector in favor of a simpler
.ratio > *selector. No more class is needed, and the ratio helper now works with any HTML element.
$embed-responsive-aspect-ratiosSass map has been renamed to
$aspect-ratiosand its values have been simplified to include the class name and the percentage as the
- CSS variables are now generated and included for each value in the Sass map. Modify the
--bs-aspect-ratiovariable on the
.ratioto create any custom aspect ratio.
- Classes have been renamed to change
Breaking “Screen reader” classes are now “visually hidden” classes.
- Changed the Sass file from
- Changed the Sass file from
bootstrap-utilities.cssnow also includes our helpers. Helpers don’t need to be imported in custom builds anymore.
All plugins can now accept a CSS selector as the first argument. You can either pass a DOM element or any valid CSS selector to create a new instance of the plugin:
var modal = new bootstrap.Modal('#myModal') var dropdown = new bootstrap.Dropdown('[data-bs-toggle="dropdown"]')
popperConfigcan be passed as a function that accepts the Bootstrap’s default Popper config as an argument, so that you can merge this default configuration in your way. Applies to dropdowns, popovers, and tooltips.
The default value for the
fallbackPlacementsis changed to
['top', 'right', 'bottom', 'left']for better placement of Popper elements. Applies to dropdowns, popovers, and tooltips.
Removed underscore from public static methods like