Breaking changes
The following changes are breaking. Note that although we've tried to include all breaking changes with migration guides in the list you still may experience undocumented changes. If you think that these changes worth including in this list, let us know by opening an issue on GitHub.
Migration to rem/em units
All Mantine components now use rem units. 1rem
is considered to be 16px
with medium text size selected by user, all components will scale based on settings specified in browser.
theme.spacing
, theme.radius
, theme.fontSizes
and other theme properties overrides
are now expected to be defined in rem. theme.breakpoints
are expected to be defined in em
units:
You can no longer use addition, subtraction, division, multiplication and other math operations
with theme values in createStyles and sx prop,
use calc
instead:
Automatic px to rem conversion
If you use numbers in Mantine components props, they will be treated as px
and converted to rem
,
for example:
The same logic is applied to style props available in every component:
createStyles breaking changes
createStyles function no longer receives getRef
as a third argument. Use getStylesRef
exported from @mantine/core
package instead:
@mantine/notifications breaking changes
@mantine/notifications package no longer exports
NotificationsProvider
component. Instead you should add Notifications
component to any
part of your application. This change allows to avoid unnecessary rerenders of child components
when notifications state change. Also useNotifications
hook is no longer exported from the package.
@mantine/rte package deprecation
@mantine/rte
package is deprecated – it will no longer receive updates (last version will remain 5.x)
and it may no longer be compatible with @mantine/core
and @mantine/hooks
packages (6.x and later versions).
Migrate to @mantine/tiptap as soon as possible.
@mantine/dates breaking changes
All components from @mantine/dates
package were rebuilt from scratch.
Note that the following list is not full as it is difficult to include all breaking changes
after a full package revamp – follow documentation of component that you use to find out about
all breaking changes.
- Styles API selectors of components were changed
DatePicker
component was renamed toDatePickerInput
Calendar
component was renamed toDatePicker
TimeInput
component was migrated to nativeinput[type="time"]
as it provides better UX in most browsersTimeRangeInput
component was removed – it is no longer exported from the packageDateRangePicker
andRangeCalendar
components were removed – you can now setup dates range picking in DatePicker and DatePickerInputamountOfMonths
prop was renamed tonumberOfColumns
in all componentsDatePickerInput
(previouslyDatePicker
) component no longer supportsallowFreeInput
prop – use DateInput component insteadDatePicker
(previouslyCalendar
) component no longer supportsdayClassName
anddayStyle
props – usegetDayProps
instead
Theme object changes
You can no longer define dateFormat
and datesLocale
in theme,
use components prop to specify format instead:
Modal and Drawer breaking changes
Modal and Drawer components props were renamed:
withFocusReturn
→returnFocus
overflow
→scrollAreaComponent
(scroll now is always handled inside modal/drawer)overlayBlur
→overlayProps.blur
overlayColor
→overlayProps.color
overlayOpacity
→overlayProps.opacity
exitTransitionDuration
→transitionProps.exitDuration
transition
→transitionProps.transition
transitionDuration
→transitionProps.duration
transitionTimingFunction
→transitionProps.timingFunction
Modal
styles API changes:
modal
selector was renamed tocontent
Drawer
styles API changes:
drawer
selector was renamed tocontent
NumberInput breaking changes
NumberInput component types for value
, defaultValue
and onChange
props were changed. It now expects value to be number | ''
(number or empty string) instead
of number | undefined
. This change was made to address multiple bugs that happened because it was
not possible to differentiate controlled and uncontrolled NumberInput
.
Pagination breaking changes
- Styles API selectors were changed
- Renamed/removed props:
itemComponent
– removed, usegetItemProps
or static components insteadgetItemAriaLabel
– removed, usegetItemProps
prop insteadinitialPage
→defaultValue
page
→value
@mantine/spotlight breaking changes
Spotlight component was migrated to use Modal under the hood. Its Styles API selectors and some props names were changed – it now supports all Modal component props.
Renamed props:
overlayBlur
→overlayProps.blur
overlayColor
→overlayProps.color
overlayOpacity
→overlayProps.opacity
exitTransitionDuration
→transitionProps.exitDuration
transition
→transitionProps.transition
transitionDuration
→transitionProps.transition
transitionTimingFunction
→transitionProps.timingFunction
Spotlight actions are now fully controlled:
actions
prop no longer accept a callback function, only a list of actions- To make register/remove features to work you will need to store actions in state
Other breaking changes
- Text no longer supports
variant="link"
, use Anchor instead - Input Styles API was changed –
disabled
,invalid
andwithIcon
selectors are no longer available, they were migrated todata-disabled
,data-invalid
anddata-with-icon
attributes - PasswordInput Styles API was changed –
invalid
andwithIcon
selectors are no longer available, usedata-invalid
anddata-with-icon
attributes withinnerInput
selector invalid
prop was renamed toerror
in Input component- FileInput, Select and MultiSelect components no longer support
clearButtonLabel
andclearButtonTabIndex
props, useclearButtonProps
instead to add any extra props to the clear button @mantine/next
package no longer exportsNextLink
component- Checkbox.Group, Switch.Group and Radio.Group components no longer include Group –
orientation
,offset
andspacing
props are no longer supported. This change gives you more freedom on how to organize inputs layout. - Chip.Group no longer includes
Group
– you need to manage layout on your side - List component Styles API was changed, it no longer has
withIcon
selector, usedata-with-icon
attribute instead withFocusReturn
prop was renamed toreturnFocus
in Modal and Drawer components- Card component now uses
padding
prop instead ofp
to offsetCard.Section
components - RichTextEditor now depends on
@tabler/icons-react
(>=2.1.0
) package instead of@tabler/icons
@mantine/core
package no longer exportsGroupedTransition
component, use multiple Transition components insteaduse-scroll-lock
hook is deprecated, all Mantine components now use react-remove-scroll- ScrollArea.Autosize component prop
maxHeight
is removed, it is replaced withmah
style prop - SegmentedControl component Styles API was changed –
labelActive
anddisabled
selectors were removed (replaced withdata-active
anddata-disabled
attributes onlabel
selector),active
selector was renamed toindicator
- Notification component prop
disallowClose
prop was renamed towithCloseButton
, it also was changed in notifications system - Tooltip component props
transition
andtransitionDuration
were renamed totransitionProps
- Popover, HoverCard, Menu, Select, MultiSelect, ColorInput and Autocomplete components
transition
,transitionDuration
andexitTransitionDuration
props were renamed totransitionProps
- Indicator component no longer has the props
dot
,showZero
andoverflowCount
. Usedisabled
andlabel
instead to recreate the previous behavior.
Variants and sizes on MantineProvider
You can now use MantineProvider to add variants to all Mantine components that support Styles API
and sizes to components that support size
prop.
Variants:
Sizes:
Updated @mantine/dates package
@mantine/dates
package was rebuilt from scratch, it now includes new components to
pick year, month
and dates. All new pickers support type
prop that can be:
default
–Date | null
– user can pick one datemultiple
–Date[]
– user can pick any number of datesrange
–[Date | null, Date | null]
– user can pick a range of two dates
type="default"
example with DatePickerInput component:
type="multiple"
example with MonthPickerInput component:
type="range"
example with YearPickerInput component:
DateTimePicker component
DateInput
YearPicker component
YearPickerInput
MonthPicker
MonthPickerInput
Calendar
Calendar
component can now be used as a base for date pickers with custom logic.
For example, you can build week picker component with it:
Mo | Tu | We | Th | Fr | Sa | Su |
---|---|---|---|---|---|---|
DatesProvider
DatesProvider
component lets you set various settings that are shared across all
components exported from @mantine/dates
package:
New PinInput component
Overlay component improvements
Overlay component now supports the following new features:
- You can now render
children
insideOverlay
- When
center
prop is set overlay children will be centered vertically and horizontally - New
fixed
prop controlsposition
, when it is setposition: fixed
, when it is not setposition: absolute
Modal and Drawer components improvements
Compound components
Modal and Drawer components
now expose compound components that can be used to build custom modals and drawers. This feature
allows you to have full control over the component rendering. Previous approach with single
Modal
/Drawer
component will still work the same way as before.
Built in ScrollArea
Modal and Drawer components now use ScrollArea component to handle scroll:
Modal offset
Modal component now supports xOffset
and yOffset
props
to control vertical and horizontal offsets of the modal content:
keepMounted prop
Components that use Transition now support keepMounted
.
When keepMounted
prop is set component will not be unmounted from the DOM and instead it will
be hidden with display: none
styles.
keepMounted
prop is supported by the following components:
Pagination component improvements
Pagination component now supports changing icons with props and compound components:
@mantine/spotlight improvements
Controlled actions
You can now fully control actions state:
Controlled search query
You can now fully control search query:
Other changes
rightSection
of all inputs is now based onsize
prop by default (previously it was a static value)- Chip component now supports
filled
,outline
andlight
variants theme.headings.fontFamily
now fallbacks totheme.fontFamily
if value is not defined onMantineProvider
- @mantine/notifications package now exports
notifications
object that includes functions to show, update, hide, clean and clean queue - @mantine/nprogress, @mantine/modals and @mantine/spotlight packages now exports
nprogress
,modals
andspotlight
objects with all package methods - use-os hook now sets initial value in
useLayoutEffect
by default (configurable with option) to avoid hydration mismatches - use-id hook now always generate random id when component is mounted to replace id generated by
React.useId
hook. This change prevents browser from showing incorrect autocomplete suggestions for inputs. - Timeline component now supports
root
Styles API selector - SegmentedControl component now supports
readOnly
prop - Kbd component now supports
size
prop - use-form now supports
form.getTransformedValues
handler - Tooltip now has better color contrast with dark color scheme
- Highlight component now supports changing styles per highlighted substring
- JsonInput component now supports
serialize
anddeserialize
props to allow custom JSON formats - Modals manager now supports type safe context modals
- @mantine/form now exports new
matchesField
validator - form.getInputProps
withError
parameter is now true by default for all inputs - New use-headroom hook