Upgrading from v5 to v6
React Suite v6 is a modern release featuring a major refactoring of the styling system (Less to SCSS), a mandatory requirement for React 18, and comprehensive support for CSS Logical Properties. This guide will help you migrate your existing v5 applications to v6.
Overview
Key breaking changes in v6 include:
- Minimum Requirements: React >= 18.0.0, IE11 is no longer supported.
- Styling System: Migrated from Less to SCSS. Adjustments are needed if you use custom themes or import Less files.
- CSS Properties: Full adoption of CSS Logical Properties (e.g.,
margin-inline-startinstead ofmargin-left) for RTL support. - Dependency Upgrade:
date-fnsupgraded to v4.
1. Upgrading Dependencies
First, update rsuite and its peer dependencies:
npm install rsuite@latest react@latest react-dom@latest
# Or
yarn add rsuite@latest react@latest react-dom@latestIf you use date-fns, ensure you upgrade to v4 as well:
npm install date-fns@^4.0.02. Style Migration (Less -> SCSS)
This is the largest change in v6. We no longer ship Less files; instead, we provide compiled CSS and SCSS source files.
If you only use compiled CSS
If you simply import rsuite/dist/rsuite.min.css, you generally don't need to make changes unless you rely on removed CSS class names or specific cascading styles.
If you use Custom Themes (Less)
In v5, you likely configured a Less loader to modify variables. In v6, to provide better performance and compatibility (e.g., RSC support), we no longer support compiling Less/SCSS variables at runtime or build time.
v6 recommends using CSS Variables for theme customization.
RSuite v6 has fully adopted the CSS Variables system. You can redefine these variables in your global CSS file to override default styles:
/* global.css */
:root {
--rs-primary-50: #e3f2fd;
--rs-primary-100: #bbdefb;
--rs-primary-200: #90caf9;
--rs-primary-500: #2196f3; /* Primary Color */
/* ...more variables */
}For more available CSS variables, please refer to the CSS Variables documentation.
Removed Deprecated Less Variables
Due to architectural changes, we no longer expose Less/SCSS variables for direct use. Please use the corresponding CSS Variables instead.
3. CSS Logical Properties & RTL
To better support Right-to-Left (RTL) languages, we replaced all Physical CSS Properties with Logical Properties.
margin-left->margin-inline-startmargin-right->margin-inline-endpadding-top->padding-block-start- ...
Impact:
If you override RSuite styles in your own CSS using physical properties (like margin-left), they might not work as expected due to specificity or property name differences. We recommend checking any style overrides related to layout.
4. Component Changes
Form Component
Layout Changes:
Formno longer includes layout-related styles and does not manage spacing between children by default.- Use the new
Form.Stackcomponent to control form layout. - For compatibility,
Formstill retainslayoutandfluidprops and will wrap aForm.Stackautomatically, but the defaultlayoutis no longervertical. You must set it explicitly.
// v5 <Form layout="horizontal">...</Form> // v6 Recommended <Form> <Form.Stack layout="horizontal">...</Form.Stack> </Form>- Use the new
Aliases:
Form.ControlLabelcan be abbreviated asForm.Label.Form.HelpTextcan be abbreviated asForm.Text.
Grid System
Property Redesign: The responsive API for
RowandColhas been redesigned for more flexibility.Col Props Deprecated: Direct props like
xs,sm,md,lg,xl,xxland theirOffset,Push,Pullvariants are deprecated.New Usage: Use the
spanprop with object syntax.// v5 <Col xs={24} md={8}>...</Col> // v6 <Col span={{ xs: 24, md: 8 }}>...</Col>FlexboxGrid: Deprecated. Use
RowandColdirectly (which are now Flex-based and more powerful).
Navbar and Nav
The pullRight prop on Nav is deprecated. Use Navbar.Content to control layout.
// v5
<Navbar>
<Nav>...</Nav>
<Nav pullRight>...</Nav>
</Navbar>
// v6
<Navbar>
<Nav>...</Nav>
<Navbar.Content>
<Nav>...</Nav>
</Navbar.Content>
</Navbar>NumberInput (formerly InputNumber)
InputNumber has been renamed to NumberInput to maintain naming consistency with other input components like DateInput and PasswordInput.
// v5
import { InputNumber } from 'rsuite';
// v6 Recommended
import { NumberInput } from 'rsuite';For compatibility, InputNumber is still retained, but migration to the new name is recommended. Additionally, NumberInput now supports the controls property.
Picker Property Renaming
To improve API consistency, a series of Picker component properties have been renamed:
| v5 Property | v6 New Property |
|---|---|
menuClassName |
popupClassName |
menuStyle |
popupStyle |
menuAutoWidth |
popupAutoWidth |
menuMaxHeight |
listboxMaxHeight |
renderMenu |
renderListbox |
renderMenuItem |
renderOption |
renderMenuGroup |
renderOptionGroup |
renderMenuItemCheckbox |
renderCheckbox |
Badge Component
The way to hide a Badge has changed. Use the invisible prop instead of setting content={false}.
Style Units (rem)
Font sizes, spacing, and other dimensions in component styles have been converted from px to rem to better support responsive typography and accessibility scaling.
FlexboxGrid (Deprecated)
FlexboxGrid is marked as deprecated. We recommend using the new Grid (CSS Grid based) or Box (Flexbox based) and Stack (Spacing management) components instead.
// v5
<FlexboxGrid>
<FlexboxGrid.Item colspan={6}>...</FlexboxGrid.Item>
</FlexboxGrid>
// v6 Recommended
<Grid>
<Col xs={6}>...</Col>
</Grid>
// Or
<Stack>...</Stack>Picker Property Renaming
To maintain API consistency, some Picker component properties may have been tweaked. Focus on the consistent behavior of generic props like cleanable and searchable across different Pickers.
Removal of Deprecated Props
Properties marked as @deprecated in v5 have been officially removed in v6. Please check console warnings and fix them before upgrading.
5. Other Breaking Changes
- DateFns v4: Components like
CalendarandDatePickerinternally depend ondate-fnsv4. If you mixdate-fnsversions in your project, be aware of compatibility. - React 17: v6 uses React 18 hooks like
useId, so React 17 is no longer supported. - IE11: Removed all Polyfills and special style handling for IE11.
Need Help?
If you encounter any issues during migration, feel free to provide feedback in GitHub Issues or discuss in Discussions.