Migrating to v1
React Bootstrap v1 adds full compatibility with Bootstrap 4. Because bootstrap 4 is a major rewrite of the project there are significant breaking changes from the pre v1 react-bootstrap.
PLEASE FIRST READ THE UPSTREAM BOOSTRAP MIGRATION GUIDE
React-Bootstrap only contains components that are present in vanilla Bootstrap. If functionality was removed from Bootstrap, then it was also removed from React-Bootstrap. This guide does not repeat information found in the upstream migration guide. Its goal is to document React-Bootstrap-specific API changes and additions.
Versioning
We will continue to provide general maintenance for Bootstrap 3 components, because there are many projects that continue to depend on Bootstrap 3 support in react-bootstrap. react-bootstrap package versions will be as follows:
- Bootstrap 3 support will continue in react-bootstrap versions <
v1.0.0 - Bootstrap 4 support will be in react-bootstrap versions >=
v1.0.0
We are not committing to keeping breaking changes in lockstep with bootstraps major releases, there may be a react-bootstrap v2 targeting Bootstrap v4 depending on what's best for the project.
Summary of breaking changes from v0.32.0
Below is a rough account of the breaking API changes as well as the minimal change to migrate
-
bsStyle->variant -
bsClass->bsPrefix -
bsRolehas been removed from all components. Components now communicate via context to allow intermediate nesting of child components -
componentClass->as - All utils have been removed from main exports, most were internal already and the rest have been moved to external libraries
Grid
- renamed to Container
- removed Clearfix
Col
- removed visibility props
- consolidated col
span,offset, andorderinto an object value prop per breakpoint.
Navbar
- removed
Navbar.Header - removed
Navbar.Form - removed
fluid, use your ownContainercomponent in. -
inverseremoved and replaced withvariant="dark" - positioning props have been consolidated into
fixed={top|bottom}andsticky={top|bottom}, staticTop has been removed
NavbarHeader
- removed, not present in v4
NavbarToggle
- name changed to
Navbar.Toggle
NavbarBrand
- Renders a
<a>when anhrefis provided - The presence of
childrendoes not skip the wrappingspan, useasalong withchildrenfor custom rendering
Nav
-
activeHrefis removed (only activeKey now) -
bsStylerenamed tovariant - NavLink hrefs will be used as
eventKeys wheneventKeyis absent - Local
onSelecthandlers are ignored when in the context of a TabContainer or Navbar (MAYBE ADD BACK?)
Nav.Item
- Renders only the outer "item" element, use inconjunction with the new
NavLinkcomponent - default element changed to
<div>from a<li> -
activeprop removed and moved toNavLink
InputGroup
- removed InputGroup.Button, and InputGroup.Addon
- added InputGroup.Prepend, InputGroup.Append, InputGroup.Text, InputGroup.Checkbox, InputGroup.Radio
Badge & Label
- removed
Label, theBadgecomponent covers both -
bsStylerenamed tovariant
Panel
- removed, replaced with Card components
Dropdown
- Removed the
disabledprop on Dropdown, pass it directly to Dropdown.Toggle - Removed bsRole, use function children to render custom Toggles or Menus
- Removed SplitButton.toggle (replaced with a
splitprop on the basic Toggle) -
noCaretis removed because it's not optional with the styles anymore - bsPrefixes are not passed from the parent Dropdown anymore
- onSelect behavior is now passed to Menu and Toggle via the Context api
- DropdownMenu is not rendered until opened
-
dividerhas been split out intoDropdown.Divider -
headerhas been split out intoDropdown.Header
DropdownButton
- Extra props are passed to the underlying Dropdown component, not the Toggle.
SplitButton
- Extra props are passed to the underlying Dropdown component, not the Toggle.
NavButton
- Extra props are passed to the underlying Dropdown component, not the Toggle.
MenuItem
- renamed to
DropdownItem(also exported onDropdownasDropdown.Item)
Alert
-
onDismissrenamed toonClose
Well
- removed.
Pager
- removed.
ControlLabel
- renamed to
FormLabel(also exported onFormasForm.Label)
Checkbox and Radio
- Consolidated into a single component. Component's name is
FormCheck(also exported onFormasForm.Check)
Glyphicon
- Removed -- icons are not included in Bootstrap 4. Icon support can be provided via react-icons, fontawesome, or a similar external library.
© 2014–present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff
Licensed under the MIT License (MIT).
https://react-bootstrap.github.io/migrating/