Back to Mantine

7 11 0

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

9.2.03.7 KB
Original Source

import { AvatarDemos, BarChartDemos, BubbleChartDemos, LineChartDemos, RadarChartDemos, TagsInputDemos, TransitionDemos, } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';

export default Layout(MDX_DATA.Changelog7110);

withProps function

All Mantine components now have withProps static function that can be used to add default props to the component:

tsx
import { IMaskInput } from 'react-imask';
import { Button, InputBase } from '@mantine/core';

const LinkButton = Button.withProps({
  component: 'a',
  target: '_blank',
  rel: 'noreferrer',
  variant: 'subtle',
});

const PhoneInput = InputBase.withProps({
  mask: '+7 (000) 000-0000',
  component: IMaskInput,
  label: 'Your phone number',
  placeholder: 'Your phone number',
});

function Demo() {
  return (
    <>
      <LinkButton href="https://mantine.dev">
        Mantine website
      </LinkButton>
      <PhoneInput placeholder="Personal phone" />
    </>
  );
}

Avatar initials

Avatar component now supports displaying initials with auto generated color based on the given name value. To display initials instead of the default placeholder, set name prop to the name of the person, for example, name="John Doe". If the name is set, you can use color="initials" to generate color based on the name:

<Demo data={AvatarDemos.initials} />

BubbleChart component

New BubbleChart component:

<Demo data={BubbleChartDemos.usage} />

BarChart waterfall type

BarChart component now supports waterfall type which is useful for visualizing changes in values over time:

<Demo data={BarChartDemos.waterfall} />

LineChart gradient type

LineChart component now supports gradient type which renders line chart with gradient fill:

<Demo data={LineChartDemos.gradient} />

Right Y axis

LineChart, BarChart and AreaChart components now support rightYAxis prop which renders additional Y axis on the right side of the chart:

<Demo data={LineChartDemos.rightYAxis} />

RadarChart legend

RadarChart component now supports legend:

<Demo data={RadarChartDemos.legend} />

TagsInput acceptValueOnBlur

TagsInput component behavior has been changed. Now By default, if the user types in a value and blurs the input, the value is added to the list. You can change this behavior by setting acceptValueOnBlur to false. In this case, the value is added only when the user presses Enter or clicks on a suggestion.

<Demo data={TagsInputDemos.acceptValueOnBlur} />

Transition delay

Transition component now supports enterDelay and exitDelay props to delay transition start:

<Demo data={TransitionDemos.delay} />

Documentation updates

Other changes

  • Pagination component now supports hideWithOnePage prop which hides pagination when there is only one page
  • Spoiler component now supports controlled expanded state with expanded and onExpandedChange props
  • Burger component now supports lineSize prop to change lines height
  • Calendar, DatePicker and other similar components now support highlightToday prop to highlight today's date