Migration to native CSS
Mantine no longer depends on Emotion for styles generation. All @mantine/*
packages are now shipped with native CSS files which can be imported from @mantine/{package}/styles.css,
for example:
This change improves performance, reduces bundle size of the library and allows using Mantine in environments where CSS-in-JS is not supported (or supported with limitations), for example, Next.js app directory.
Important breaking changes:
createStylesfunction is no longer available, use CSS modules or any other styling solution of your choice instead- Components no longer support
sxprop. You can useclassNameorstyleprops instead. stylesprop no longer supports nested selectors
It is now recommended to use CSS modules to style Mantine components. To update your project to CSS modules, follow the 6.x → 7.x migration guide.
Vanilla extract integration
If you prefer CSS-in-JS syntax for styling, you can use Vanilla extract as a TypeScript CSS preprocessor. You will be able to use most of Mantine styling features with Vanilla extract.
System color scheme support
All components now support system color scheme – when colorScheme value is auto,
components will use prefers-color-scheme media query to determine if the user prefers light or dark color scheme.
Note that auto is not the default value. You need to set it manually to enable system color scheme support
both on MantineProvider and in ColorSchemeScript:
Built-in color scheme manager
MantineProvider now comes with a built-in color scheme manager. It is no longer required to use any other components to set up color scheme logic. Color scheme can be changed with useMantineColorScheme hook:
CSS modules and PostCSS preset
CSS modules is now the recommended way to style Mantine components, although it is not required – you can choose any other styling solution of your choice.
It is also recommended to use postcss-preset-mantine. It includes mixins and functions to simplify styling of Mantine components. postcss-preset-mantine is included in all templates.
Global styles
Mantine no longer includes normalize.css. Instead, it uses a bare minimum set of global styles.
These styles are part of the @mantine/core package and are applied automatically when you import
@mantine/core/styles.css in your application. Note that these styles cannot be decoupled from the
rest of the library.
Mantine as a headless UI library
You can now use Mantine as a headless library. To achieve that, just do not import
@mantine/*/styles.css in your application. Then you will be able to apply styles with
Styles API.
createTheme function
createTheme function is a replacement for MantineThemeOverride type. Use it to create a theme
override, it will give you autocomplete for all theme properties:
Components extend functions
All components that support default props or Styles API now have a static extend function which allows getting autocomplete when customizing
defaultProps, classNames and styles of the component
on theme:
classNames based on component props
You can now get component props in classNames and styles to conditionally apply styles. This feature is a more powerful replacement for styles params.
Components CSS variables
You can now customize components CSS variables to change component styles based on its props. For example, it can be used to add new sizes:
New variants system
All components now have data-variant attribute on the root element, even if the component does not have any predefined variants.
You can use it to apply styles to all components of the same type on theme:
New sizes system
There are multiple ways to customize component sizes:
- With
data-sizeattribute - With component CSS variables
- With static CSS variables
Example of customizing Button size with data-size attribute:
theme.variantColorResolver
Button, Badge, ActionIcon, ThemeIcon and other components now support custom variants with variantColorResolver – it supports both changing colors of existing variants and adding new variants.
rem units scaling
It is now possible to scale rem units. It is useful when you want to change
font-size of html/:root element and preserve Mantine components sizes. For example, if you would like to set html font-size to 10px and scale Mantine components accordingly, you need
to set scale to 1 / (10 / 16) (16 – default font-size) = 1 / 0.625 = 1.6:
color prop improvements
All components that support color prop now support the following color values:
- Key of
theme.colors, for example,blue theme.colorsindex reference, for example,blue.5- Any valid CSS color value, for example,
#fff,rgba(0, 0, 0, 0.5),hsl(0, 0%, 100%)
Filled variant
Light variant
Outline variant
Components classes
Classes of each component are now available in Component.classes object. For example, you can
find Button classes in Button.classes:
| Key | Class |
|---|---|
| root | m_77c9d27d |
| inner | m_80f1301b |
| label | m_811560b9 |
| section | m_a74036a |
| loader | m_a25b86ee |
| group | m_80d6d844 |
| groupSection | m_70be2a01 |
You can use these classes to create components with the same styles as Mantine components:
Theme object changes
theme.lineHeightis nowtheme.lineHeights– it is now possible to specify multiple line heights.theme.lineHeightsvalues are used in the Text component.theme.colorSchemeis no longer available, use useMantineColorScheme to get color scheme valuetheme.diris no longer needed, direction is now managed by DirectionProvidertheme.loaderwas removed, you can now configure default loader with default props of Loader componenttheme.transitionTimingFunctionwas removedtheme.focusRingStyleswas replaced withtheme.focusClassNametheme.activeStyleswas replaced withtheme.activeClassNametheme.globalStyleswas removedtheme.fnfunctions were removed, some of the functions are available as standalone utilities- New theme.scale property controls rem units scaling
- New
theme.fontSmoothingproperty determines whether font smoothing styles should be applied to the body element - New theme.variantColorResolver property allows customizing component colors per variant
Colors generator
New @mantine/colors-generator package is now available to generate color palettes based on single color value. It is also available as online tool. Note that it is usually better to generate colors in advance to avoid contrast issues.
New setup for RTL
@mantine/core package now exports DirectionProvider component, which should be used to configure the direction of the application.
useDirection hook can be used to toggle direction. All components now include RTL styles by default, it is no
longer required to set up additional plugins. See RTL documentation to learn more.
React 18+ only
Starting from version 7.0 Mantine no longer supports older React versions. The minimum supported version is now React 18. It is required because Mantine components now use useId and useSyncExternalStore hooks, which are available only in React 18.
left and right section
Components that previously had rightSection and icon props, now use leftSection instead of icon.
Example of Button sections:
NumberInput changes
NumberInput was migrated to react-number-format. It now supports more features and has improvements in cursor position management. Due to migration, some of the props were renamed – follow the documentation to learn about the changes.
Loader changes
Loader component is now built with CSS only. This change improves performance and reduces HTML output of the component.
Theme object no longer supports theme.loader property –
it is also now possible to add custom loaders on theme with default props.
Specified Loader will be used in all components that use it under the hood (LoadingOverlay, Button, ActionIcon, Stepper, etc.).
Progress changes
Progress component now supports compound components pattern. Advanced features that were previously implemented in Progress are now supposed to be implemented with compound components instead.
Table changes
Table component changes:
- Styles API support
- It is now required to use compound components instead of elements:
Table.Tr,Table.Td, etc. - It is now easier to override styles – all styles are added with classes instead of deeply nested selectors on root element
- New props:
borderColor,withRowBorders,stripedColor,highlightOnHoverColor withBorderprop was renamed towithTableBorderfontSizeprop was removed, usefzstyle prop instead- New
Table.ScrollContainercomponent to create scrollable table
| Element position | Element name | Symbol | Atomic mass |
|---|---|---|---|
| 6 | Carbon | C | 12.011 |
| 7 | Nitrogen | N | 14.007 |
| 39 | Yttrium | Y | 88.906 |
| 56 | Barium | Ba | 137.33 |
| 58 | Cerium | Ce | 140.12 |
Group changes
Group component changes:
positionprop was renamed tojustify– it now supports alljustify-contentvaluesnoWrapprop was replaced withwrap="nowrap",wrapprop now supports allflex-wrapvaluesspacingprop was replaced withgapGroupnow supports newpreventGrowOverflowprop which allows customizing how group items will behave when they grow larger than their dedicated space
Tabs changes
- Styles API selector
tabsListrenamed tolist TabPropstype was renamed toTabsTabPropsonTabChangeprop was renamed toonChangeTabs.Listpositionprop was renamed tojustify, it now supports alljustify-contentvalues
Button changes
compactprop was removed, usesize="compact-XXX"insteadleftIconandrightIconprops were renamed toleftSectionandrightSectionuppercaseprop was removed, usettstyle prop insteadloaderPositionprop was removed, Loader is now always rendered in the center to prevent layout shifts- Styles API selectors were changed, see Button Styles API documentation for more details
AppShell changes
AppShell component was completely rewritten, it now supports more features:
AppShellnow uses compound components pattern:Navbar,Aside,HeaderandFooterare no longer exported from@mantine/corepackage. Instead, useAppShell.Navbar,AppShell.Aside, etc.AppShellnow supports animations when navbar/aside are opened/closed- Navbar/aside can now be collapsed on desktop – state is handled separately for mobile and desktop
- Header/footer can now be collapsed the same way as navbar/aside. For example, the header can be collapsed based on scroll position or direction.
AppShellno longer supportsfixedprop – all components haveposition: fixedstyles, static positioning is no longer supported- The documentation was updated, it now includes 10+ examples on a separate page
SimpleGrid changes
SimpleGrid now uses object format to define grid breakpoints and spacing, it works the same way as style props.
1
2
3
4
5
Grid changes
Grid now uses object format in gutter, offset, span and order props,
all props now work the same way as style props.
Image changes
Image component changes:
Imagecomponent no longer includesfigureand other associated elementscaptionprop is no longer availablewidthandheightprops are replaced withwandhstyle props- Placeholder functionality was replaced with fallback image
Spotlight changes
Spotlight changes:
- The logic is no longer based on React context
SpotlightProviderwas renamed toSpotlightuseSpotlighthook was removed, usespotlightobject insteadactionsprop now uses a different data format- It is now possible to have multiple spotlights in the same app
Spotlightcomponent now uses compound components pattern for advanced customization
Carousel changes
Carousel now uses object format for responsive values in
slideSize and slideGap props instead of breakpoints prop:
@mantine/prism deprecation
@mantine/prism package was deprecated in favor of @mantine/code-highlight package. The new package uses highlight.js instead of Prism.
Fieldset component
New Fieldset component:
Combobox component
The new Combobox component allows building custom select, autocomplete, tags input, multiselect and other similar components. It is used as a base for updated Autocomplete, Select, TagsInput and MultiSelect components.
Combobox is very flexible and allows you to have full control over the component rendering and logic. Advanced features that were previously implemented in Autocomplete, Select and MultiSelect are now supposed to be implemented with Combobox instead.
You can find 50+ Combobox examples on this page.
TagsInput component
New TagsInput component based on Combobox component. The component is similar to MultiSelect but allows entering custom values.
withErrorStyles prop
All inputs now support withErrorStyles prop, which allows removing error styles from the input.
It can be used to apply custom error styles without override, or use other techniques to
indicate error state. For example, it can be used to render an icon in the right section:
Something went wrong
Something went wrong
hiddenFrom and visibleFrom props
All Mantine components now support hiddenFrom and visibleFrom props.
These props accept breakpoint (xs, sm, md, lg, xl) and hide the component when
viewport width is less than or greater than the specified breakpoint:
Other changes
- New VisuallyHidden component
- New ActionIcon.Group component
- DatesProvider now supports setting timezone
- All transitions are now disabled during color scheme change
theme.respectReducedMotionis now set tofalseby default – it caused a lot of confusion for users who did not know about it- Notifications system now exports
notifications.updateStatefunction to update notifications state with a given callback - Blockquote component has new design
- Breadcrumbs component now supports
separatorMarginprop - Tooltip component now supports
mainAxisandcrossAxisoffset configuration - Slider and RangeSlider components
radiusprop now affects thumb as well as track - NativeSelect component now supports setting options as
childrenand options groups - Anchor component now supports
underlineprop which lets you configure how link will be underlined:hover(default),alwaysornever - Affix component no longer supports
targetprop, useportalPropsinstead - Drawer component no longer supports
targetprop, useportalPropsinstead:portalProps={{ target: '.your-selector' }} - Container component no longer supports
sizesprop, use CSS variables to customize sizes on theme instead useComponentDefaultPropshook was renamed to usePropswithinPortalprop is now true by default in all overlay components (Popover, HoverCard, Tooltip, etc.)AlphaSliderandHueSlidercomponents are no longer available, they can be used only as a part of ColorPicker- Text default root element is now
<p /> - Title no longer supports all Text props, only style props are available
MediaQuerycomponent was removed – use CSS modules to apply responsive styles- Highlight component prop
highlightColorwas renamed tocolor - Tooltip and Tooltip.Floating components no longer support
widthprop, usewstyle prop instead - Stack component
spacingprop was renamed togap - Input and other
Inputbased componentsiconprop was renamed toleftSection - Loader component
variantprop was renamed totype @mantine/corepackage no longer depends on Radix UI ScrollArea, ScrollArea component is now a native Mantine component – it reduces bundle size, allows setting CSP for styles and improves performance (all styles are now applied with classes instead of inline<style />tags)- Overlay
opacityprop was renamed tobackgroundOpacityto avoid collision withopacitystyle prop - Badge Styles API selectors were changed, see Badge Styles API documentation for more details
- Slider Styles API selectors were changed, see Slider Styles API documentation for more details
- Text component no longer supports
underline,color,strikethrough,italic,transform,alignandweightprop – use style props instead - Portal component
innerRefprop was renamed toref - ScrollArea now supports
xandyvalues inoffsetScrollbarsprop TransferListcomponent is no longer available as a part of@mantine/corepackage, instead you can implement it with Combobox component (example)- Chip component now supports custom check icon
- PasswordInput no longer supports
visibilityToggleLabelandtoggleTabIndexprops, usevisibilityToggleButtonPropsprop instead - Stepper no longer supports
breakpointprop, you can apply responsive styles with Styles API - ColorInput no longer supports
dropdownZIndex,transitionProps,withinPortal,portalPropsandshadowprops, you can now pass these props withpopoverPropsprop - LoadingOverlay props are now grouped by the component they are passed down to:
overlayProps,loaderPropsandtransitionPropsnow replace props that were previously passed toLoadingOverlaydirectly - Dropzone component no longer supports
paddingprop, usepstyle prop instead - Dialog component now supports all Paper and Affix props,
transitionDuration,transitionand other transition related props were replaced withtransitionProps - Checkbox, Radio, Chip and Switch components now support
rootRefprop which allows using them with Tooltip and other similar components - Grid no longer has
overflow: hiddenstyles by default, you can enable it by settingoverflowprop tohidden