Components API changes
Tabs
Tabs and associated Prism.Tabs components now have new API. New API provides the following enhancements:
- Tabs are now more accessible
- Tabs content no longer unmounts on tab change, it is hidden with
display: none - It is now easier to manage controlled tabs state with string value instead of index
- With new component structure it is now easier to modify styles of each part with
sxorclassnameprops
Tabs component now supports the following new props:
radiusprop (defaults totheme.defaultRadius)invertedprop allows to display panels before controlsloopprop control arrow keys behavior (allows to go from first to last and vice versa)activateTabWithKeyboardprop controls how tabs respond to arrows and Home/End key pressesallowTabDeactivationprop allows user to deactivate current active tab
Accordion
Accordion component now has new API with the following new props:
variantprop controls visuals, Accordion now has 4 variantsradiusprop (defaults totheme.defaultRadius) controls border-radius for all variants exceptdefaultloopprop control arrow keys behavior (allows to go from first to last and vice versa)disabledprop allows to disable itemsiconprop adds icon to the opposite side of chevron
Tooltip
Tooltip now requires children to be an element or a component.
String, numbers, fragments and multiple elements are no longer supported. In addition to that Tooltip no longer wraps target
element with div tag, events are added directly to target element.
Popover
Popover component now has new API with the following breaking changes:
placementprop is no longer supported, Popover side and alignment is now controlled withpositionprop- Default value for
trapFocusandwithinPortalprops is nowfalse - Close button and title are no longer supported, if you need these parts – add them on your side in
Popover.Dropdowncomponent
Popover now supports the following new features:
- Uncontrolled and controlled mode
width="target"prop will make popover width the same as target elementPopover.Dropdowncan now be styled with system props (sx,className, padding props, etc.)
Menu
Menu component now uses Popover component under the hood and thus its API was changed in the same way:
- Menu no longer provides default control, it should now be added with
Menu.Target Menu.Itemcomponent should now be used withinMenu.DropdowncomponenttrapFocusprop was removed – now it is managed automatically based ontriggerpropcloseOnScrollprop was removed – if you need this feature you will need to implement this logic on your side
Avatar
AvatarsGroup component is no longer exported from @mantine/core package, instead you can now use
Avatar.Group component which can be combined with Tooltip or Popover to display additional information:
InputWrapper
InputWrapper component is no longer exported from @mantine/core package, instead you can now use
Input.Wrapper component:
Dropzone
Dropzone component was migrated to context, it no longer supports
function as children. Instead, you can use Dropzone.Accept, Dropzone.Reject and Dropzone.Idle components
to display content based on current status.
Other Dropzone changes:
FullScreenDropzonecomponent is no longer exported from the@mantine/dropzonepackage, useDropzone.FullScreencomponent insteadDropzone.FullScreennow supports all props fromDropzonecomponentDropzonenow usesdata-*attributes instead of classes to change styles of root element based on current statusDropzoneandDropzone.FullScreencomponents now supports the following new props:maxFiles,autoFocus,activateOnClick,activateOnDrag,activateOnKeyboard,dragEventsBubbling,onDragEnter,onDragLeave,onDragOver,onFileDialogCancel,onFileDialogOpen,preventDropOnDocument
Migration to Floating UI
All components that have dropdowns (DatePicker, Popover, Select, etc.) were migrated to Floating UI from popper.js:
positionandplacementprops were merged intopositionprop, for example,position="top-start"- Popper component is no longer exported from
@mantine/corepackage
MantineProvider changes
defaultProps, styles and classNames props
MantineProvider no longer supports styles, classNames and defaultProps props.
Instead of separate props these values should be added to the theme. This change allows to store
all components in one object and share it across multiple environments. For example, it is now much easier
to share theme between application and Storybook:
emotionCache prop
MantineProvider no longer supports emotionOptions
prop, instead you will need to create emotion cache on your side and provide it with emotionCache prop.
This change was made to enable custom cache to be used during ssr and support more options for emotion
usage, for example with shadow dom or with iframe.
Emotion packages as peer dependencies
@emotion/react and @emotion/server packages are now not installed automatically (see related issue) –
you will need to install them manually:
Styles API changes
data- attributes
Most of components state were migrated to data- attributes. This allows to override styles
more predictably without using !important and reduces complexity of components Styles API.
Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Inputs styles API
You can use Input and Input.Wrapper Styles API
on MantineProvider to add styles to all Inputs:
Polymorphic components changes
Because of internal changes polymorphic components props types exported from @mantine/core package are no longer generic types.
Now if you want to extend these types you need to provide associated element types on your side.
You can find updated polymorphic components guide here.
@mantine/form changes
use-form no longer exports formList function, you can now
manage lists with just regular arrays. Other changes:
- You can now use objects and lists with any level of nesting
useFormhook now supportsclearInputErrorOnChangeoption to disable error clearing when input value changes andvalidateInputOnChangeoption that adds support for live fields validationform.onSubmithandler now accepts second argument – a function that will be called with errors object when validation failsform.addListItemwas renamed toform.insertListItem, it now supports inserting items add given indexschemaoption was merged withvalidateoption
Other breaking changes
- Select and MultiSelect component now require returning created item from
onCreatehandler - Portal component no longer accepts
positionandzIndexprops – it is now required to add these styles to Portal children - Modal component no longer supports
size="full", usesize="100%"instead - FloatingTooltip component was renamed to Tooltip.Floating
- Most components with dropdowns (Tooltip, Popover, ColorPicker, DatePicker, Select, etc.) are no longer using Portal by default, it is now required to set
withinPortalif you need this feature - Input no longer supports
headlessvariant, useunstyledprop instead - AppShell
fixedprop is nowtrueby default - CheckboxGroup, RadioGroup and Chips components are no longer exported from
@mantine/core, useCheckbox.Group,Radio.GroupandChip.Groupcomponents instead @mantine/hookspackage no longer exports olduse-formhook, use@mantine/formpackage instead- Group component no longer supports
directionprop, use Stack component instead for vertical stacks - use-uncontrolled hook logic was changed, it no longer supports
ruleparameter - use-id hook now supports React 18
useIdhook with a fallback for older React versions,generateIdfunction is no longer supported @mantine/hookspackage no longer exportsuseBooleanTogglehook, useuseDisclosurehook instead- use-toggle hook API was changed, it no longer accepts initial value as first argument
- use-intersection hook API was changed to keep API consistent across all hooks
- use-focus-return hook no longer supports
transitionDurationprop due to changes in use-focus-trap hook - use-notifications hook from
@mantine/notificationspackage no longer hasshowNotification,hideNotificationand other functions, use separate functions exported from the package for that idprop in Modals manager was renamed tomodalIddue to React 18 issues- Button component no longer provides separate classes for variants
@mantine/carousel package
New @mantine/carousel package based on embla carousel:
@mantine/nprogress package
New @mantine/nprogress package displays navigation progress bar at the top of the page, it can be easily integrated with Next.js and other similar frameworks:
React 18 support
All Mantine components now support React 18, all known issues related to React 18 migration were fixed:
- ColorPicker and ColorInput components no longer throw error on value change
- Issue with stale Dropzone status was fixed
- Multiple issues with types were fixed (mostly related to
childrenprop changes) - The entire Mantine codebase was migrated to React 18 (documentation website, Mantine UI, all packages)
Unstyled components
All components now support unstyled prop which removes all non-essential Mantine styles
from the component. This is useful when you want to style some component from scratch
without overwriting any styles.
Unstyled Tabs:
Unstyled Accordion:
New theme properties
activeStyles
theme.activeStyles lets you override styles added to buttons with :active pseudo-class:
fontWeight for each heading
theme.headings now has an option to set fontWeight for each heading individually:
defaultGradient
theme.defaultGradient defines default gradient value for components that support variant="gradient" (Button, ThemeIcon, etc.):
respectReduceMotion
theme.respectReduceMotion allows to disregard user OS settings and play animations as usual:
cursorType
theme.cursorType determines which cursor type will native controls have.
If it is set to pointer then Checkbox,
Radio, NativeSelect
and other native elements will have cursor: pointer style.
New components
NavLink component
New NavLink component:
HoverCard component
New HoverCard component:
CopyButton component
New CopyButton component:
FileInput component
New FileInput component:
FileButton component
New FileButton component:
FocusTrap component
New FocusTrap component:
New features
ScrollArea.Autosize component
ScrollArea.Autosize component lets you use
ScrollArea with maxHeight:
Tooltip delay group
Tooltip.Group component can be used to sync open and close delays for multiple tooltips:
Button.Group component
Button.Group merges borders of adjacent buttons:
Fullscreen Modal
Modal component now supports fullScreen prop:
Input.Wrapper inputContainer prop
All inputs that use Input.Wrapper component under the hood (TextInput, Autocomplete, DatePicker, etc.)
now support inputContainer prop. This prop let you add additional elements before/after input element or add floating
elements that will be positioned relative to the input. Example with Tooltip:
Input.Wrapper inputWrapperOrder prop
New inputWrapperOrder prop allows to define the order of Input.Wrapper parts:
Input.Label, Input.Error and Input.Description
Input component now exposes Input.Label, Input.Error and Input.Description,
that were previously the parts of InputWrapper component. You can use these components to create custom
form layouts if default Input.Wrapper layout does not fit your requirements:
Card.Section improvements
Card.Section now supports the following props to simplify customizations:
withBorderprop will add top and bottom border toCard.Sectiondepending on its position relative to other content and sectionsinheritPaddingprop will add the same left and right padding toCard.Sectionas set inCardcomponent
Slider thumbSize
Slider and RangeSlider components now support thumbSize prop
to configure thumbs width and height from prop:
New hooks
Other changes
- Affix now supports
withinPortalprop - Burger now supports
transitionDurationprop - Collapse now support
refprop - NumberInput has new increment/decrement controls
- ThemeIcon now support any CSS color value in
colorprop - Text now supports numbers in
sizeprop to set size in px - RichTextEditor now uses tabler icons instead of Radix icons
- LoadingOverlay now supports
overlayBlurprop - Slider now supports
HomeandEndkeys - Modals manager now supports event based functions, it is now the primary way to work with the package
- Prism now supports
radiusprop - DatePicker now supports
modalPropsto spread props to inner Modal component - Anchor and Text components will now inherit font-size from parent if
sizeprop is not set - ScrollArea now supports
type="never"to hide scrollbars
Documentation updates
- Custom components guide explains how to add default props and Styles API integration with MantineProvider to any component
- Polymorphic components guide explains how to create custom polymorphic components by extending
Box - Theme object documentation describes all theme properties with demos
- Default props documentation explains how components default props work