apps/mantine.dev/src/pages/changelog/8-0-0.mdx
import { Button } from '@mantine/core'; import { HeartIcon } from '@phosphor-icons/react'; import { DatePickerDemos, DateTimePickerDemos, TimePickerDemos, TimeValueDemos, TimeGridDemos, CodeHighlightDemos, SwitchDemos, MenuDemos, PopoverDemos, HeatmapDemos, } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';
export default Layout(MDX_DATA.Changelog800);
You can now sponsor Mantine development with OpenCollective. All funds are used to improve Mantine and create new features and components.
<SponsorButton />This changelog covers breaking changes and new features in Mantine 8.0. To migrate your application to Mantine 8.0, follow 7.x → 8.x migration guide.
Global styles are now split between 3 files:
baseline.css – a minimal CSS reset, sets box-sizing: border-box and changes font propertiesdefault-css-variables.css – contains all CSS variables generated from the default themeglobal.css – global classes used in Mantine componentsIf you previously imported individual styles from @mantine/core package, you need to update imports
to use new files:
import '@mantine/core/styles/baseline.css';
import '@mantine/core/styles/default-css-variables.css';
import '@mantine/core/styles/global.css';
If you imported @mantine/core/styles.css, no changes are required –
all new files are already included in styles.css.
Menu component now supports submenus:
<Demo data={MenuDemos.sub} demoProps={{ defaultExpanded: false }} />
Popover component now supports hideDetached prop to configure how the dropdown behaves when the target
element is hidden with styles (display: none, visibility: hidden, etc.),
removed from the DOM, or when the target element is scrolled out of the viewport.
By default, hideDetached is enabled – the dropdown is hidden with the target element.
You can change this behavior with hideDetached={false}. To see the difference, try to scroll
the root element of the following demo:
<Demo data={PopoverDemos.hideDetached} demoProps={{ defaultExpanded: false }} />
All @mantine/dates components now use date strings in YYYY-MM-DD or YYYY-MM-DD HH:mm:ss
format instead of Date objects. This change was made to resolve issues related to timezones
– now the output of all @mantine/dates components does not include any timezone-specific information.
Follow 7.x → 8.x migration guide to learn how to update the code to use new string values.
Example of using DatePicker component with string values:
<Demo data={DatePickerDemos.usage} />DatesProvider component no longer supports timezone option – all @mantine/dates
components now use strings in YYYY-MM-DD HH:mm:ss format as values and do not contain
timezone information.
If you need to handle timezones in your application, you can use a dedicated dates library (dayjs, luxon, date-fns) to update timezone values.
Example of using Mantine components with dayjs:
import dayjs from 'dayjs';
import { DatePicker } from '@mantine/dates';
function Demo() {
const [value, setValue] = useState<string | null>('2022-08-21');
// Mantine components use strings as values, you can pass these
// strings to a dates library of your choice to assign timezone
const dateWithTimeZone = dayjs(value).tz("America/Toronto").toDate();
return <DatePicker value={value} onChange={setValue} />;
}
New TimePicker component is an alternative to TimeInput that offers more features. It supports 24-hour and 12-hour formats, dropdown with hours, minutes and seconds, and more.
<Demo data={TimePickerDemos.withDropdown} />DateTimePicker component now uses TimePicker under the hood instead of TimeInput. You can now use all TimePicker features with DateTimePicker component.
Prop timeInputProps is no longer available, to pass props down to the underlying TimePicker
you need to use timePickerProps prop.
Example of enabling dropdown and setting 12h format for time picker:
New TimeValue component can be used to display a formatted time string with similar formatting options to TimePicker component.
<Demo data={TimeValueDemos.usage} />New TimeGrid component allows to capture time value from the user with a predefined set of time slots:
<Demo data={TimeGridDemos.usage} />New Heatmap component allows to display data in a calendar heatmap format:
<Demo data={HeatmapDemos.tooltip} />@mantine/code-highlight package no longer depends on
highlight.js. Instead, it now provides a new API based
on adapters that allows using any syntax highlighter of your choice. Out of the, box
@mantine/code-highlight provides adapters for shiki and
highlight.js.
To learn about the migration process and how to use the new adapters API, check the updated CodeHighlight documentation and 7.x → 8.x migration guide.
You can now use CodeHighlight component with shiki.
Shiki library provides the most advanced syntax highlighting for TypeScript and CSS/Sass code. It uses textmate grammars to highlight code (same as in VSCode). Shiki adapter is recommended if you need to highlight advanced TypeScript (generics, jsx nested in props) or CSS code (custom syntaxes, newest features). Shiki adapter is used for all code highlighting in Mantine documentation.
To use shiki adapter, you need to install shiki package:
Then wrap your app with CodeHighlightAdapterProvider and provide createShikiAdapter as adapter prop:
import { MantineProvider } from '@mantine/core';
import { CodeHighlightAdapterProvider, createShikiAdapter } from '@mantine/code-highlight';
// Shiki requires async code to load the highlighter
async function loadShiki() {
const { createHighlighter } = await import('shiki');
const shiki = await createHighlighter({
langs: ['tsx', 'scss', 'html', 'bash', 'json'],
themes: [],
});
return shiki;
}
const shikiAdapter = createShikiAdapter(loadShiki);
function App() {
return (
<MantineProvider>
<CodeHighlightAdapterProvider adapter={shikiAdapter}>
</CodeHighlightAdapterProvider>
</MantineProvider>
);
}
After that, you can use CodeHighlight component in your application:
@mantine/carousel package was updated to use the latest version of
embla-carousel-react package. This update includes breaking changes:
speed and draggable props were removed – they are no longer supported by embla-carousel-reactembla-carousel and embla-carousel-react packages explicitlyuseAnimationOffsetEffect hook was removed – the issue it addressed was fixed in embla-carousel-reactEmbla type export was removed, you should use EmblaCarouselType from embla-carousel insteademblaOptions propFollow the 7.x → 8.x migration guide to update your application to use the latest version of @mantine/carousel.
Switch component styles were updated to include indicator inside the thumb.
You can change it by setting withThumbIndicator prop:
You can now augment spacing, radius, breakpoints, fontSizes, lineHeights,
and shadows types. To learn more about this feature, follow this guide.
Example of types augmentation for spacing and radius:
import {
DefaultMantineSize,
MantineThemeSizesOverride,
} from '@mantine/core';
type ExtendedCustomSpacing =
| 'xxl'
| 'xxxs'
| DefaultMantineSize;
type ExtendedCustomRadius =
| 'xxs'
| DefaultMantineSize;
declare module '@mantine/core' {
export interface MantineThemeSizesOverride {
spacing: Record<ExtendedCustomSpacing, string>;
radius: Record<ExtendedCustomRadius, string>;
}
}
size proppreserveTime prop, use different component to capture time valuesdisplay: table styles on the wrapper element of the content. It also now supports content Styles API selector to apply styles to the content element.flex: 0 styles by defaultwrapperProps prop in all components that support it (Checkbox, Radio, Chip, most inputs) was changed to more strict typereuseTargetNode prop enabled by defaultsetFieldValue handler types are now stricterdata-hovered attribute, use :hover and :focus selectors instead to apply styleschromeos value in the union