Back to Mantine

7 5 0

apps/mantine.dev/src/pages/changelog/7-5-0.mdx

9.5.05.3 KB
Original Source

import { AreaChartDemos, DatePickerInputDemos, DatesProviderDemos, DonutChartDemos, PieChartDemos, TitleDemos, } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.Changelog750);

DonutChart component

New DonutChart component:

<Demo data={DonutChartDemos.usage} />

PieChart component

New PieChart component:

<Demo data={PieChartDemos.usage} />

@mantine/dates value formatter

DatePickerInput, MonthPickerInput and YearPickerInput now support valueFormatter prop.

valueFormatter is a more powerful alternative to valueFormat prop. It allows formatting value label with a custom function. The function is the same for all component types (default, multiple and range) – you need to perform additional checks inside the function to handle different types.

Example of using a custom formatter function with type="multiple":

<Demo data={DatePickerInputDemos.valueFormatter} />

@mantine/dates consistent weeks

You can now force each month to have 6 weeks by setting consistentWeeks: true on DatesProvider. This is useful if you want to avoid layout shifts when month changes.

<Demo data={DatesProviderDemos.consistentWeeks} />

Charts series label

It is now possible to change series labels with label property in series object. This feature is supported in AreaChart, BarChart and LineChart components.

<Demo data={AreaChartDemos.seriesLabels} />

Charts value formatter

All @mantine/charts components now support valueFormatter prop, which allows formatting value that is displayed on the y axis and inside the tooltip.

<Demo data={AreaChartDemos.valueFormatter} />

Headings text wrap

New Title textWrap prop sets text-wrap CSS property. It controls how text inside an element is wrapped.

<Demo data={TitleDemos.textWrap} />

You can also set textWrap on theme:

tsx
import { createTheme, MantineProvider, Title } from '@mantine/core';

const theme = createTheme({
  headings: {
    textWrap: 'wrap',
  },
});

function Demo() {
  return (
    <MantineProvider theme={theme}>
      <Title>Some very long title that should wrap</Title>
    </MantineProvider>
  );
}

If set on theme, textWrap is also applied to headings in Typography

mod prop

All components now support mod prop, which allows adding data attributes to the root element:

tsx
import { Box } from '@mantine/core';

<Box mod="data-button" />;
// -> <div data-button />

<Box mod={{ opened: true }} />;
// -> <div data-opened />

<Box mod={{ opened: false }} />;
// -> <div />

<Box mod={['button', { opened: true }]} />;
// -> <div data-button data-opened />

<Box mod={{ orientation: 'horizontal' }} />;
// -> <div data-orientation="horizontal" />

Documentation updates

Help center updates

New articles added to the help center:

Other changes