migration.md 14.7 KB
Newer Older
1
---
Mark Otto's avatar
Mark Otto committed
2
layout: docs
3
4
title: Migrating to v5
description: Track and review changes to the Bootstrap source files, documentation, and components to help you migrate from v4 to v5.
5
group: migration
XhmikosR's avatar
XhmikosR committed
6
aliases: "/migration/"
7
toc: true
8
9
---

XhmikosR's avatar
XhmikosR committed
10
11
## v5.0.0-alpha2

12
13
### Sass

Mark Otto's avatar
Mark Otto committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
- "Screen reader" classes are now "visually hidden" classes.
  - Changed the Sass file from `scss/helpers/_screenreaders.scss` to `scss/helpers/_visually-hidden.scss`
  - Renamed `.sr-only` and `.sr-only-focusable` to `.visually-hidden` and `.visually-hidden-focusable`
  - Renamed `sr-only()` and `sr-only-focusable()` mixins to `visually-hidden()` and `visually-hidden-focusable()`.

### Docs

- Renamed "Screen readers" helper page to "Visually hidden", and filename to `visually-hidden`
- Renamed "Checks" page to "Checks & radios", and filename to `checks-radios`
- Improved documentation of check/radio powered button groups

### Reboot

- Updated `th` styling to use a default `null` value for `font-weight` and inherit `text-align` instead of setting explicitly.
28

Mark Otto's avatar
Mark Otto committed
29
30
31
32
33
34
35
### Colors

- Bumped color contrast ratio from 3:1 to 4.5:1.
- Set `$black` as color contrast color instead of `$gray-900`.
- Improved `$green` (and its theme alias `$success`) color to reach new minimum color contrast (moving from `#28a745` to `#198754`).
- Improved `$cyan` (and its theme alias `$info`) color to be more vibrant (moving from `#17a2b8` to `#0dcaf0`).

XhmikosR's avatar
XhmikosR committed
36
37
### Components

38
39
40
41
#### Buttons

- Disabled states of buttons are easier to customize thanks to additional arguments in the `button-variant()` mixin. [See #30639.](https://github.com/twbs/bootstrap/pull/30639)

Mark Otto's avatar
Mark Otto committed
42
43
44
45
#### Navs

- Added new `null` variables for `font-size`, `font-weight`, `color`, and `:hover` `color` to the `.nav-link` class.

XhmikosR's avatar
XhmikosR committed
46
47
48
49
#### Popovers

- Renamed `whiteList` option to `allowList`

50
51
52
53
#### Toasts

- Make default toast duration 5 seconds

XhmikosR's avatar
XhmikosR committed
54
55
56
57
58
59
60
61
62
#### Tooltips

- Renamed `whiteList` option to `allowList`

---

## v5.0.0-alpha1

### Browser support
63

64
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:
65

66
- Dropped support for Internet Explorer 10 and 11
XhmikosR's avatar
XhmikosR committed
67
68
69
70
71
72
- Dropped support for Microsoft Edge < 16
- Dropped support for Firefox < 60
- Dropped support for Safari < 10
- Dropped support for iOS Safari < 10
- Dropped support for Chrome < 60
- Dropped support for Android < 6
73

XhmikosR's avatar
XhmikosR committed
74
### Sass
75

76
Changes to our source Sass files and compiled CSS.
77

Mark Otto's avatar
Mark Otto committed
78
- Removed `hover`, `hover-focus`, `plain-hover-focus`, and `hover-focus-active` mixins. Use regular CSS syntax for these moving forward. [See #28267](https://github.com/twbs/bootstrap/pull/28267).
Martijn Cuppens's avatar
Martijn Cuppens committed
79
- Remove previously deprecated mixins
80
81
  - `float()`
  - `form-control-mixin()`
Martijn Cuppens's avatar
Martijn Cuppens committed
82
  - `nav-divider()`
83
84
85
  - `retina-img()`
  - `text-hide()` (also dropped the associated utility class, `.text-hide`)
  - `visibility()`
86
  - `form-control-focus()`
87
88
89
- **Todo:** New variables?
- **Todo:** Rearrange forms source files (under `scss/forms/`)
- **Todo:** Rearrange grid source files (under `scss/grid/`)
90
- Removed print styles and `$enable-print-styles` variable. Print display classes, however, have remained intact. [See #28339](https://github.com/twbs/bootstrap/pull/28339).
91
92
- Dropped `color()`, `theme-color()` & `gray()` functions in favor of variables. [See #29083](https://github.com/twbs/bootstrap/pull/29083)
- The `theme-color-level()` function is renamed to `color-level()` and now accepts any color you want instead of only `$theme-color` colors. [See #29083](https://github.com/twbs/bootstrap/pull/29083)
93
- `$enable-grid-classes` doesn't disable the generation of container classes anymore [See #29146](https://github.com/twbs/bootstrap/pull/29146)
Mark Otto's avatar
Mark Otto committed
94
- Renamed `$enable-prefers-reduced-motion-media-query` and `$enable-pointer-cursor-for-buttons` to `$enable-reduced-motion` and `$enable-button-pointers` for brevity.
95
- Line heights are dropped from several components to simplify our codebase. The `button-size()` and `pagination-size()` do not accept line height parameters anymore. [See #29271](https://github.com/twbs/bootstrap/pull/29271)
96
97
- The `button-variant()` mixin now accepts 3 optional color parameters, for each button state, to override the color provided by `color-contrast()`. By default, these parameters will find which color provides more contrast against the button state's background color with `color-contrast()`.
- The `button-outline-variant()` mixin now accepts an additional argument, `$active-color`, for setting the button's active state text color. By default, this parameter will find which color provides more contrast against the button's active background color with `color-contrast()`.
98
99
- Ditch the Sass map merges, which makes 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]({{< docsref "/customize/sass#maps-and-loops" >}}).
- `color-yiq()` function and related variables are renamed to `color-contrast()` since it's not related to YIQ colorspace anymore. [See #30168.](https://github.com/twbs/bootstrap/pull/30168/)
XhmikosR's avatar
XhmikosR committed
100
101
  - `$yiq-contrasted-threshold` is renamed to `$min-contrast-ratio`.
  - `$yiq-text-dark` and `$yiq-text-light` are respectively renamed to `$color-contrast-dark` and `$color-contrast-light`.
Martijn Cuppens's avatar
Martijn Cuppens committed
102
- Linear gradients are simplified when gradients are enabled and therefore, `gradient-bg()` now only accepts an optional `$color` parameter.
XhmikosR's avatar
XhmikosR committed
103
- The `bg-gradient-variant()` mixin is removed since the `.bg-gradient` class can now be used to add gradients to elements instead of the `.bg-gradient-*` classes.
104
105
- The `media-breakpoint-down()` uses the breakpoint itself instead of the next breakpoint. Use `media-breakpoint-down(lg)` instead of `media-breakpoint-down(md)` to target viewports smaller than the `lg` breakpoint.
- The `media-breakpoint-between()` mixin's second parameter also uses the breakpoint itself instead of the next breakpoint. Use `media-between(sm, lg)` instead of `media-breakpoint-between(sm, md)` to target viewports between the `sm` and `lg` breakpoints.
106

XhmikosR's avatar
XhmikosR committed
107
### JavaScript
108

109
Changes to our source and compiled JavaScript files.
Mark Otto's avatar
Mark Otto committed
110

111
- Dropped jQuery dependency and rewrote plugins to be in regular JavaScript.
XhmikosR's avatar
XhmikosR committed
112
- Removed underscore from public static methods like `_getInstance()``getInstance()`.
Mark Otto's avatar
Mark Otto committed
113

XhmikosR's avatar
XhmikosR committed
114
### Color system
115
116
117

We've updated the color system that powers Bootstrap to improve color contrast and provide a much more extensive set of colors.

XhmikosR's avatar
XhmikosR committed
118
- Updated blue and pink base colors (`-500`) to ensure WCAG 2.1 AA contrast.
119
120
- Added new tints and shades for every color, providing nine separate colors for each base color, as new Sass variables.
- To support our color system, we've added new custom `tint-color()` and `shade-color()` functions to mix our colors appropriately.
121

XhmikosR's avatar
XhmikosR committed
122
### Grid and layout
Mark Otto's avatar
Mark Otto committed
123

124
Changes to any layout tools and our grid system.
Mark Otto's avatar
Mark Otto committed
125

XhmikosR's avatar
XhmikosR committed
126
- Dropped the `.media` component as it can be built with utility classes. [See #28265](https://github.com/twbs/bootstrap/pull/28265).
127
128
129
130
- Remove `position: relative` from 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.
XhmikosR's avatar
XhmikosR committed
131
- The responsive gutter classes can be used to control the gutter width in horizontal, vertical or both directions.
132
- The gutter width is now set in `rem` and decreased from `30px` to `1.5rem` (24px).
XhmikosR's avatar
XhmikosR committed
133
- `bootstrap-grid.css` now only applies `box-sizing: border-box` to the column instead of resetting the global box-sizing. This way the grid system can be used, even if `box-sizing: border-box` is not applied to each element.
Mark Otto's avatar
Mark Otto committed
134

XhmikosR's avatar
XhmikosR committed
135
### Content, Reboot, etc
Mark Otto's avatar
Mark Otto committed
136

137
Changes to Reboot, typography, tables, and more.
Mark Otto's avatar
Mark Otto committed
138

Martijn Cuppens's avatar
Martijn Cuppens committed
139
- [RFS]({{< docsref "/getting-started/rfs" >}}) enabled for automated font size rescaling. [See #29152](https://github.com/twbs/bootstrap/pull/29152)
140
- Reset default horizontal `padding-left` on `<ul>` and `<ol>` elements from browser default `40px` to `2rem`.
141
142
143
144
- Simplified table styles (no more odd top border) and tightened cell padding.
- Nested tables do not inherit styles anymore.
- `.thead-light` and `.thead-dark` are dropped in favor of the `.table-*` variant classes which can be used for all table elements (`thead`, `tbody`, `tfoot`, `tr`, `th` and `td`).
- The `table-row-variant()` mixin is renamed to `table-variant()` and accepts only 2 parameters: `$color` (colon name) and `$value` (color code). The border color and accent colors are automatically calculated based on the table factor variables.
145
- Split table cell padding variables into `-y` and `-x`.
146
- Dropped `.pre-scrollable` class. [See #29135](https://github.com/twbs/bootstrap/pull/29135)
147
- `.text-*` utilities do not add hover and focus states to links anymore. `.link-*` helper classes can be used instead. [See #29267](https://github.com/twbs/bootstrap/pull/29267)
148
- Drop `.text-justify` class. [See #229793](https://github.com/twbs/bootstrap/pull/29793)
149

XhmikosR's avatar
XhmikosR committed
150
### Typography
Mark Otto's avatar
Mark Otto committed
151
152

- Removed `$display-*` variables for a new `$display-font-sizes` Sass map.
153
- Removed individual `$display-*-weight` variables for a single `$display-font-weight`.
Mark Otto's avatar
Mark Otto committed
154
155
156
- Added two new `.display-*` heading styles, `.display-5` and `.display-6`.
- Resized existing display headings for a slightly more consistent set of `font-size`s.

XhmikosR's avatar
XhmikosR committed
157
### Forms
158

Mark Otto's avatar
Mark Otto committed
159
160
- Rearranged form documentation under its own top-level section.
  - Split out old Forms page into several subpages
XhmikosR's avatar
XhmikosR committed
161
  - Moved input groups docs under the new Forms section
Mark Otto's avatar
Mark Otto committed
162
163
164
- Rearranged source Sass files under `scss/forms/`, including moving over input group styles.
- Combined native and custom checkboxes and radios into single `.form-check` class.
  - New checks support sizing via `em`/`font-size` or explicit modifier classes now.
165
  - New checks now appear larger by default for improved usability.
Mark Otto's avatar
Mark Otto committed
166
  - Dropped `.custom-control` and associated classes.
167
  - Renamed most `$custom-control` variables to `$form-control` ones.
Mark Otto's avatar
Mark Otto committed
168
169
- Combined native and custom selects into `.form-select`.
  - Dropped `.custom-select` and associated classes.
170
  - Renamed most `$custom-select` variables to `$form-select` ones.
XhmikosR's avatar
XhmikosR committed
171
- Updated file input component with the same overall design, but improved HTML.
172
173
174
175
  - Refactored `.form-file` markup to resolve some visual bugs while allowing translation and button text changes via HTML instead of CSS.
  - Dropped native `.form-control-file` and `.form-control-range` components entirely.
  - Renamed `.custom-file` to `.form-file` (including variables).
  - Added support for `:focus` and `:disabled` styles.
Mark Otto's avatar
Mark Otto committed
176
177
- Renamed `.custom-range` to `.form-range` (including variables).
- Dropped `.form-group` for margin utilities (we've replaced our docs examples with `.mb-3`).
178
179
- Dropped `.form-row` for the more flexible grid gutters.
- Dropped `.form-inline` for the more flexible grid.
Mark Otto's avatar
Mark Otto committed
180
- Dropped support for `.form-control-plaintext` inside `.input-group`s.
181
- Dropped `.input-group-append` and `.input-group-prepend`. You can now just add buttons and `.input-group-text` as direct children of the input groups.
182
- Form labels now require the `.form-label` class. Sass variables are now available to style form labels to your needs. [See #30476](https://github.com/twbs/bootstrap/pull/30476)
183

XhmikosR's avatar
XhmikosR committed
184
### Components
185

186
187
- Unified `padding` values for alerts, breadcrumbs, cards, dropdowns, list groups, modals, popovers, and tooltips to be based on our `$spacer` variable. [See #30564](https://github.com/twbs/bootstrap/pull/30564).

XhmikosR's avatar
XhmikosR committed
188
#### Disabled states
189
190
191

- Disabled states of the buttons, close button, pagination link & form range now have `pointer-events: none` added. This simplifies our codebase and makes it easier to override active states in CSS. [#29296](https://github.com/twbs/bootstrap/pull/29296).

XhmikosR's avatar
XhmikosR committed
192
#### Alerts
193

194
- **Todo:** Remove auto-darkening of `<hr>` elements in `.alert-*` class variants. `<hr>`s use `rgba()` for their color, so these should naturally blend anyway.
195

XhmikosR's avatar
XhmikosR committed
196
#### Badges
197

198
Badges were overhauled to better differentiate themselves from buttons and to better utilize utility classes.
199

200
201
202
- **Todo:** Removed and replaced `.badge` modifier classes with background utility classes (e.g., use `.bg-primary` instead of `.badge-primary`)
- **Todo:** Removed `.badge-pill` for the `.rounded-pill` utility class
- **Todo:** Removed badge's hover and focus styles for `a.badge` and `button.badge`.
Mark Otto's avatar
Mark Otto committed
203

XhmikosR's avatar
XhmikosR committed
204
#### Buttons
205

206
- The checkbox/radio toggle is removed from the button plugin in favour of a CSS only solution, which is documented in the [form checks and radios]({{< docsref "/forms/checks-radios#toggle-buttons" >}}) docs. The `.btn-check` class can be added to inputs, any label with `.btn` and modifier class can be used to theme the labels. [See #30650](https://github.com/twbs/bootstrap/pull/30650).
207

XhmikosR's avatar
XhmikosR committed
208
#### Cards
209
210

- Removed the card columns in favor of a Masonry grid [See #28922](https://github.com/twbs/bootstrap/pull/28922).
XhmikosR's avatar
XhmikosR committed
211
- Removed card decks in favor of the grid which adds more flexibility over responsive behavior.
212

XhmikosR's avatar
XhmikosR committed
213
#### Jumbotron
214
215
216

- The jumbotron component is removed in favor of utility classes like `.bg-light` for the background color and `.p-*` classes to control padding.

XhmikosR's avatar
XhmikosR committed
217
#### Navbars
218
219
220

- All navbars now require a container within. This drastically simplifies spacing requirements and removes the need for extensive CSS overrides we added for responsive containers in v4.

XhmikosR's avatar
XhmikosR committed
221
#### Pagination
222
223
224

- Pagination links now have customizable `margin-left` that are dynamically rounded on all corners when separated from one another.

XhmikosR's avatar
XhmikosR committed
225
#### Popovers
226
227
228

- Renamed `.arrow` to `.popover-arrow`

XhmikosR's avatar
XhmikosR committed
229
#### Tooltips
230
231
232

- Renamed `.arrow` to `.tooltip-arrow`

XhmikosR's avatar
XhmikosR committed
233
### Accessibility
234

235
- Unlike the old `.sr-only-focusable`, which only worked in combination with `.sr-only`, `.sr-only-focusable` can be used as a standalone class without `.sr-only`. [See #28720](https://github.com/twbs/bootstrap/pull/28720).
236

XhmikosR's avatar
XhmikosR committed
237
### Utilities
238

239
- Renamed `.text-monospace` to `.font-monospace`
240
- Decreased the number of responsive order utilities per breakpoint. The highest order utility with a number now is `.order-5` instead of `.order-12`. [See #28874](https://github.com/twbs/bootstrap/pull/28874).
241
- New `line-height` utilities: `.lh-1`, `.lh-sm`, `.lh-base` and `.lh-lg`. See [here]({{< docsref "/utilities/text#line-height" >}}).
242
- Added `.bg-body` for quickly setting the `<body>`'s background to additional elements.
243
244
- **Todo:** Drop `.text-hide` as it's an antiquated method for hiding text that shouldn't be used anymore
- **Todo:** Split utilities into property-value utility classes and helpers
245
- 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.
Mark Otto's avatar
Mark Otto committed
246

XhmikosR's avatar
XhmikosR committed
247
### Docs
248

XhmikosR's avatar
XhmikosR committed
249
- Removed "Wall of browser bugs" page because it has become obsolete
XhmikosR's avatar
XhmikosR committed
250
251
252
- Switched from Jekyll to Hugo

### Build tools
253

XhmikosR's avatar
XhmikosR committed
254
255
- Updated all devDependencies
- We support only the latest Node.js LTS releases which are 10 and 12 at the time of writing