Introduction
MDB 5 was written from scratch. Literally every line of code has been rewritten to ensure the highest possible quality.
The changes are very significant and in many cases it was not possible to maintain backward compatibility. We chose the right quality over backward compatibility and it was a deliberate decision.
Therefore, whenever possible, we recommend that you create your project from scratch in MDB5, instead of updating old MDB 4 projects to MDB 5.
Note: The following list is not complete. Only the most key changes are listed, but you should bear in mind that no component has remained unchanged.
Migrating from v2 to v3
After updating the MDB Standard from version 2 to 3, there were some breaking changes that must be introduced in
existing projects to keep them stable. These changes relate in particular to data attributes and RTL integration.
Data attributes refactor:
All JavaScript components are now namespaced to help distinguish MDB functionality from third parties and your own
code. Infix mdb has been added to all attributes.
For example, we use data-mdb-toggle instead of data-toggle.
RTL integration:
Part of our approach to adding RTL to MDB was to add it in a way that felt future-friendly to ourselves and the web at large. As such, we’ve embraced the spirit of CSS logical properties and have renamed several classes and variables. It’s a risky change because of the size and impact of the change, but we hope you’ll appreciate it overall!
RTL migration checklist:
Components:
- Renamed
.dropleftand.droprightto.dropstartanddropend. - Renamed
.dropdown-menu-*-leftand.dropdown-menu-*-rightto.dropdown-menu-*-startand.dropdown-menu-*-end. - Renamed
.bs-popover-leftand.bs-popover-rightto.bs-popover-startand.bs-popover-end. - Renamed
.bs-tooltip-leftand.bs-tooltip-rightto.bs-tooltip-startand.bs-tooltip-end. - Renamed
.carousel-item-leftand.carousel-item-rightto.carousel-item-startand.carousel-item-end.
Utilities:
- Renamed
.left-*and.right-*to.start-*and.end-*. - Renamed
.float-leftand.float-rightto.float-startand.float-end. - Renamed
.border-leftand.border-rightto.border-startand.border-end. - Renamed
.rounded-leftand.rounded-rightto.rounded-startand.rounded-end. - Renamed
.ml-*and.mr-*to.ms-*and.me-*. - Renamed
.pl-*and.pr-*to.ps-*and.pe-*. - Renamed
.text-leftand.text-rightto.text-startand.text-end.
Mixins:
- Renamed
border-left-radius()andborder-right-radius()toborder-start-radius()andborder-end-radius()— as well as their corner relative variants (eg..border-bottom-left-radiusbecame.border-bottom-start-radius). - Renamed
caret-left()andcaret-right()tocaret-start()andcaret-end()— subsequently, thecaret()mixin now takesstartandendas arguments instead ofleftandright.
Variables:
- New
$breadcrumb-divider-flippedif a different breadcrumb separator is needed in RTL. - Renamed
$navbar-brand-margin-rightto$navbar-brand-margin-end. - Renamed
$pagination-margin-leftto$pagination-margin-start. - Renamed
$form-check-padding-leftto$form-check-padding-start. - Renamed
$form-switch-padding-leftto$form-switch-padding-start. - Renamed
$form-check-inline-margin-rightto$form-check-inline-margin-end. - Renamed
$form-select-feedback-icon-padding-rightto$form-select-feedback-icon-padding-end.
Other important changes:
- Added
.fs-*utilities forfont-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. - Renamed
.font-weight-*utilities as.fw-*for brevity and consistency. - Renamed
.font-style-*utilities as.fst-*for brevity and consistency. - Added
.d-gridto display utilities - Added new gap utilities (.gap) for CSS Grid layouts
Browser support
See the browser and devices page for details on what is currently supported in Bootstrap 5. Since v4, here’s what’s changed to our browser support:
- Dropped support for Internet Explorer 10 and 11
- Dropped support for Microsoft Edge Legacy
- Dropped support for Firefox NN - MM
- Dropped support for Safari NN
- Dropped support for iOS Safari NN
- Dropped support for Chrome NN
- Dropped support for Android NN
JavaScript
Changes to our source and compiled JavaScript files.
- Dropped jQuery dependency and rewrote plugins to be in regular JavaScript.
- Auto Initialization for all components (no need for initializing components like sidenav or select as it was in MDB 4).
- Ability to work on the server, with module bundlers and with the browser thanks to the compilation to the UMD (Universal Module Definition) format.
- Three ways of initializing and customizing any advanced component (via data attributes, via JavaScript, via jQuery).
- ES6 friendly components importing as a single module or a library.
- Optional jQuery integration.
Grid and layout
Changes to any layout tools and our grid system.
-
Dropped the
.mediacomponent as it can be built with utility classes. - Remove
position: relativefrom grid columns. -
The horizontal padding is added to the direct children in a row instead
of the columns themselves.
- This simplifies our codebase.
-
The column classes can now be used stand alone. Whenever they are
used outside a
.row, horizontal padding won’t be added.
- The responsive gutter classes can be used to control the gutter width in horizontal, vertical or both directions.
-
The gutter width is now set in
remand decreased from30pxto1.5rem(24px). -
bootstrap-grid.cssnow only appliesbox-sizing: border-boxto the column instead of resetting the global box-sizing. This way the grid system can be used, even ifbox-sizing: border-boxis not applied to each element.
Input fields
All forms were completely rewritten. The syntax has also been standardized to ensure consistency throughout the project.
- Default and material 1.0 inputs were dropped. Only outline inputs are available now.
- Rename
.md-formto.form-outline -
Combined native and custom checkboxes and radios into single
.form-checkclass.-
New checks support sizing via
em/font-sizeor explicit modifier classes now. - New checks now appear larger by default for improved usability.
- Dropped
.custom-controland associated classes. -
Renamed most
$custom-controlvariables to$form-controlones.
-
New checks support sizing via
-
Updated file input component
-
Refactored
.form-filemarkup to resolve some visual bugs while allowing translation and button text changes via HTML instead of CSS. -
Dropped native
.form-control-fileand.form-control-rangecomponents entirely. -
Renamed
.custom-fileto.form-file(including variables). -
Added support for
:focusand:disabledstyles.
-
Refactored
-
Renamed
.custom-rangeto.form-range(including variables). -
Dropped
.form-groupfor margin utilities (we’ve replaced our docs examples with.mb-3). -
Dropped
.form-rowfor the more flexible grid gutters. - Dropped
.form-inlinefor the more flexible grid. -
Dropped support for
.form-control-plaintextinside.input-groups. -
Dropped
.input-group-appendand.input-group-prepend. You can now just add buttons and.input-group-textas direct children of the input groups.
Disabled states
-
Disabled states of the buttons, close button, pagination link & form
range now have
pointer-events: noneadded. This simplifies our codebase and makes it easier to override active states in CSS.
Jumbotron
-
The jumbotron component is removed in favor of utility classes like
.bg-lightfor the background color and.p-*classes to control padding.
Pagination
-
Pagination links now have customizable
margin-leftthat are dynamically rounded on all corners when separated from one another.
Utilities
-
Renamed
.text-monospaceto.font-monospace -
Decreased the number of responsive order utilities per breakpoint. The
highest order utility with a number now is
.order-5instead of.order-12. -
New
line-heightutilities:.lh-1,.lh-sm,.lh-baseand.lh-lg. -
Added
.bg-bodyfor quickly setting the<body>'s background to additional elements. -
Negative margin utilities are disabled by default. You can re-enable
them by setting
$enable-negative-margins: true, but keep in mind this can increase the file size quite a lot. -
Added
.fs-*utilities forfont-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. -
Renamed
.font-weight-*utilities as.fw-*for brevity and consistency. -
Renamed
.font-style-*utilities as.fst-*for brevity and consistency. -
Added
.d-gridto display utilities - Added new
gaputilities (.gap) for CSS Grid layouts
Completely rewritten components
Below is a list of components with completely changed syntax and source code. For this reason, their migration from MDb 4 to MDB 5 is practically impossible, because they are actually completely different components. Therefore, they should be created from scratch in the project.