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
sx
orclassname
props
Tabs component now supports the following new props:
radius
prop (defaults totheme.defaultRadius
)inverted
prop allows to display panels before controlsloop
prop control arrow keys behavior (allows to go from first to last and vice versa)activateTabWithKeyboard
prop controls how tabs respond to arrows and Home/End key pressesallowTabDeactivation
prop allows user to deactivate current active tab
Accordion
Accordion component now has new API with the following new props:
variant
prop controls visuals, Accordion now has 4 variantsradius
prop (defaults totheme.defaultRadius
) controls border-radius for all variants exceptdefault
loop
prop control arrow keys behavior (allows to go from first to last and vice versa)disabled
prop allows to disable itemsicon
prop 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:
placement
prop is no longer supported, Popover side and alignment is now controlled withposition
prop- Default value for
trapFocus
andwithinPortal
props is nowfalse
- Close button and title are no longer supported, if you need these parts – add them on your side in
Popover.Dropdown
component
Popover now supports the following new features:
- Uncontrolled and controlled mode
width="target"
prop will make popover width the same as target elementPopover.Dropdown
can 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.Item
component should now be used withinMenu.Dropdown
componenttrapFocus
prop was removed – now it is managed automatically based ontrigger
propcloseOnScroll
prop 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:
FullScreenDropzone
component is no longer exported from the@mantine/dropzone
package, useDropzone.FullScreen
component insteadDropzone.FullScreen
now supports all props fromDropzone
componentDropzone
now usesdata-*
attributes instead of classes to change styles of root element based on current statusDropzone
andDropzone.FullScreen
components 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:
position
andplacement
props were merged intoposition
prop, for example,position="top-start"
- Popper component is no longer exported from
@mantine/core
package
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
useForm
hook now supportsclearInputErrorOnChange
option to disable error clearing when input value changes andvalidateInputOnChange
option that adds support for live fields validationform.onSubmit
handler now accepts second argument – a function that will be called with errors object when validation failsform.addListItem
was renamed toform.insertListItem
, it now supports inserting items add given indexschema
option was merged withvalidate
option
Other breaking changes
- Select and MultiSelect component now require returning created item from
onCreate
handler - Portal component no longer accepts
position
andzIndex
props – 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
withinPortal
if you need this feature - Input no longer supports
headless
variant, useunstyled
prop instead - AppShell
fixed
prop is nowtrue
by default - CheckboxGroup, RadioGroup and Chips components are no longer exported from
@mantine/core
, useCheckbox.Group
,Radio.Group
andChip.Group
components instead @mantine/hooks
package no longer exports olduse-form
hook, use@mantine/form
package instead- Group component no longer supports
direction
prop, use Stack component instead for vertical stacks - use-uncontrolled hook logic was changed, it no longer supports
rule
parameter - use-id hook now supports React 18
useId
hook with a fallback for older React versions,generateId
function is no longer supported @mantine/hooks
package no longer exportsuseBooleanToggle
hook, useuseDisclosure
hook 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
transitionDuration
prop due to changes in use-focus-trap hook - use-notifications hook from
@mantine/notifications
package no longer hasshowNotification
,hideNotification
and other functions, use separate functions exported from the package for that id
prop in Modals manager was renamed tomodalId
due 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
children
prop 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:
withBorder
prop will add top and bottom border toCard.Section
depending on its position relative to other content and sectionsinheritPadding
prop will add the same left and right padding toCard.Section
as set inCard
component
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
withinPortal
prop - Burger now supports
transitionDuration
prop - Collapse now support
ref
prop - NumberInput has new increment/decrement controls
- ThemeIcon now support any CSS color value in
color
prop - Text now supports numbers in
size
prop to set size in px - RichTextEditor now uses tabler icons instead of Radix icons
- LoadingOverlay now supports
overlayBlur
prop - Slider now supports
Home
andEnd
keys - Modals manager now supports event based functions, it is now the primary way to work with the package
- Prism now supports
radius
prop - DatePicker now supports
modalProps
to spread props to inner Modal component - Anchor and Text components will now inherit font-size from parent if
size
prop 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