apps/mantine.dev/src/pages/changelog/7-14-0.mdx
import { AngleSliderDemos, BarChartDemos, FunnelChartDemos, ModalDemos, RadialBarChartDemos, SliderDemos, } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';
export default Layout(MDX_DATA.Changelog7140);
New AngleSlider component:
<Demo data={AngleSliderDemos.marks} />New RadialBarChart component:
<Demo data={RadialBarChartDemos.labels} />New FunnelChart component:
<Demo data={FunnelChartDemos.usage} />New Modal.Stack and Drawer.Stack components simplify usage of multiple modals/drawers at the same time.
Use Modal.Stack component to render multiple modals at the same time.
Modal.Stack keeps track of opened modals, manages z-index values, focus trapping
and closeOnEscape behavior. Modal.Stack is designed to be used with useModalsStack hook.
Differences from using multiple Modal components:
Modal.Stack manages z-index values – modals that are opened later will always have higher z-index value disregarding their order in the DOMModal.Stack disables focus trap and Escape key handling for all modals except the one that is currently openedopacity: 0 and pointer-events: noneuseModalsStack hook provides an easy way to control multiple modals at the same time.
It accepts an array of unique modals ids and returns an object with the following properties:
interface ModalStackReturnType<T extends string> {
// Current opened state of each modal
state: Record<T, boolean>;
// Opens modal with the given id
open: (id: T) => void;
// Closes modal with the given id
close: (id: T) => void;
// Toggles modal with the given id
toggle: (id: T) => void;
// Closes all modals within the stack
closeAll: () => void;
// Returns props for modal with the given id
register: (id: T) => {
opened: boolean;
onClose: () => void;
stackId: T;
};
}
Example of using useModalsStack with Modal component:
import { Modal, useModalsStack } from '@mantine/core';
function Demo() {
const stack = useModalsStack(['first', 'second']);
return (
<>
<Modal {...stack.register('first')}>First</Modal>
<Modal {...stack.register('second')}>Second</Modal>
<Button onClick={() => stack.open('first')}>Open first</Button>
</>
);
}
Slider component now supports restrictToMarks prop that restricts slider value to marks only.
Note that in this case step prop is ignored:
BarChart now can be used with SVG pattern fill:
<Demo data={BarChartDemos.stripes} />onNodeExpand and onNodeCollapse callbackscheckAllNodes, uncheckAllNodes and setCheckedState handlersgetTreeExpandedState to generate expanded state based on the tree dataform.replaceListItem handler to replace list item at given index