Releases: mantinedev/mantine
7.7.2
What's Changed
[@mantine/core]
CloseButton: Add missing disabled styles (#6044)[@mantine/core]
AppShell: Fix incorrect app safe area handling by AppShell.Footer (#6060)[@mantine/core]
NumberInput: Fix cursor position changing when the value is incremented/decremented (#6004)[@mantine/core]
TagsInput: Fix incorrect IME keyboard input handling forBackspace
key (#6011)[@mantine/charts]
Fix incorrect overflow styles of svg element (#6040)[@mantine/core]
PinInput: AddrootRef
prop support (#6032)[@mantine/core]
ScrollArea: FixviewportProps.onScroll
not working (#6055)[@mantine/core]
ScrollArea: Fix incorrect inset position of the horizontal scrollbar (#6059)[@mantine/hooks]
use-local-storage: Fix infinite rerendering with object values (#6022)
New Contributors
Full Changelog: 7.7.1...7.7.2
7.7.1
What's Changed
[@mantine/tiptap]
Improve toolbar items alignment for non-native elements (#5993)[@mantine/spotlight]
Fix incorrect down key handling when the spotlight is opened repeatedly (#5995)[@mantine/core]
Image: Fix ref not being assigned for fallback images (#5989)[@mantine/core]
PinInput: Fix incorrect focus logic (#5963)[@mantine/core]
Table: FixhighlightOnHoverColor
prop not working[@mantine/core]
AppShell: Adjust footer position to include env(safe-area-inset-bottom) (#5502)[@mantine/core]
PinInput: Fix placeholder not being visible on the element that had focus when the component becomes disabled (#5831)[@mantine/dates]
Calendar: Fix double timezone shift (#5916)[@mantine/hooks]
use-local-storage: Fix value not being updated when key is changed (#5910)[@mantine/charts]
Fix incorrect charts legends height for multiline values (#5923)[@mantine/core]
NumberInput: Fix incorrect increment/decrement functions logic whenstep
is a float value (#5926)[@mantine/core]
Combobox: Fix incorrect IME input handling (#5935)[@mantine/core]
Menu: Fix unexpected focus styles in the dropdown element in Firefox (#5957)[@mantine/core]
Fix incorrectdisabled
prop handling in TagsInput and MultiSelect (#5959)[@mantine/core]
FixrenderOption
not working for grouped items in Combobox-based components (#5952)[@mantine/core]
AppShell: Fix error when used inside Suspense (#5979)[@mantine/core]
Update CSS selectors hashing algorithm to prevent collisions with other libraries (#5968)[@mantine/carousel]
Fix specificity issues of some selectors (#5973)[@mantine/core]
AppShell: Fix missing Aside offset in Header and Footer forlayout=alt
(#5974)
New Contributors
- @naughton made their first contribution in #5952
- @wasamistake made their first contribution in #5971
- @elecdeer made their first contribution in #5935
- @israelins85 made their first contribution in #5910
- @1g0rrr made their first contribution in #5916
- @joshua-webdev made their first contribution in #5963
- @s-cork made their first contribution in #5989
- @xiaohanyu made their first contribution in #5993
Full Changelog: 7.7.0...7.7.1
7.7.0
View changelog with demos on mantine.dev website
Virtual colors
Virtual color is a special color which values should be different for light and dark color schemes.
To define a virtual color, use virtualColor
function which accepts an object with the following
properties as a single argument:
name
β color name, must be the same as the key intheme.colors
objectlight
β a key oftheme.colors
object for light color schemedark
β a key oftheme.colors
object for dark color scheme
To see the demo in action, switch between light and dark color schemes (Ctrl + J
):
import { createTheme, MantineProvider, virtualColor } from '@mantine/core';
const theme = createTheme({
colors: {
primary: virtualColor({
name: 'primary',
dark: 'pink',
light: 'cyan',
}),
},
});
function App() {
return <MantineProvider theme={theme}>{/* Your app here */}</MantineProvider>;
}
FloatingIndicator component
New FloatingIndicator component:
import { useState } from 'react';
import {
IconArrowDown,
IconArrowDownLeft,
IconArrowDownRight,
IconArrowLeft,
IconArrowRight,
IconArrowUp,
IconArrowUpLeft,
IconArrowUpRight,
IconCircle,
} from '@tabler/icons-react';
import { FloatingIndicator, UnstyledButton } from '@mantine/core';
import classes from './Demo.module.css';
function Demo() {
const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);
const [controlsRefs, setControlsRefs] = useState<Record<string, HTMLButtonElement | null>>({});
const [active, setActive] = useState('center');
const setControlRef = (name: string) => (node: HTMLButtonElement) => {
controlsRefs[name] = node;
setControlsRefs(controlsRefs);
};
return (
<div className={classes.root} dir="ltr" ref={setRootRef}>
<FloatingIndicator
target={controlsRefs[active]}
parent={rootRef}
className={classes.indicator}
/>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up-left')}
ref={setControlRef('up-left')}
mod={{ active: active === 'up-left' }}
>
<IconArrowUpLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up')}
ref={setControlRef('up')}
mod={{ active: active === 'up' }}
>
<IconArrowUp size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up-right')}
ref={setControlRef('up-right')}
mod={{ active: active === 'up-right' }}
>
<IconArrowUpRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('left')}
ref={setControlRef('left')}
mod={{ active: active === 'left' }}
>
<IconArrowLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('center')}
ref={setControlRef('center')}
mod={{ active: active === 'center' }}
>
<IconCircle size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('right')}
ref={setControlRef('right')}
mod={{ active: active === 'right' }}
>
<IconArrowRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down-left')}
ref={setControlRef('down-left')}
mod={{ active: active === 'down-left' }}
>
<IconArrowDownLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down')}
ref={setControlRef('down')}
mod={{ active: active === 'down' }}
>
<IconArrowDown size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down-right')}
ref={setControlRef('down-right')}
mod={{ active: active === 'down-right' }}
>
<IconArrowDownRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
</div>
);
}
ScatterChart component
New ScatterChart component:
import { useState } from 'react';
import {
IconArrowDown,
IconArrowDownLeft,
IconArrowDownRight,
IconArrowLeft,
IconArrowRight,
IconArrowUp,
IconArrowUpLeft,
IconArrowUpRight,
IconCircle,
} from '@tabler/icons-react';
import { FloatingIndicator, UnstyledButton } from '@mantine/core';
import classes from './Demo.module.css';
function Demo() {
const [rootRef, setRootRef] = useState<HTMLDivElement | null>(null);
const [controlsRefs, setControlsRefs] = useState<Record<string, HTMLButtonElement | null>>({});
const [active, setActive] = useState('center');
const setControlRef = (name: string) => (node: HTMLButtonElement) => {
controlsRefs[name] = node;
setControlsRefs(controlsRefs);
};
return (
<div className={classes.root} dir="ltr" ref={setRootRef}>
<FloatingIndicator
target={controlsRefs[active]}
parent={rootRef}
className={classes.indicator}
/>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up-left')}
ref={setControlRef('up-left')}
mod={{ active: active === 'up-left' }}
>
<IconArrowUpLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up')}
ref={setControlRef('up')}
mod={{ active: active === 'up' }}
>
<IconArrowUp size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('up-right')}
ref={setControlRef('up-right')}
mod={{ active: active === 'up-right' }}
>
<IconArrowUpRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('left')}
ref={setControlRef('left')}
mod={{ active: active === 'left' }}
>
<IconArrowLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('center')}
ref={setControlRef('center')}
mod={{ active: active === 'center' }}
>
<IconCircle size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('right')}
ref={setControlRef('right')}
mod={{ active: active === 'right' }}
>
<IconArrowRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
<div className={classes.controlsGroup}>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down-left')}
ref={setControlRef('down-left')}
mod={{ active: active === 'down-left' }}
>
<IconArrowDownLeft size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down')}
ref={setControlRef('down')}
mod={{ active: active === 'down' }}
>
<IconArrowDown size={26} stroke={1.5} />
</UnstyledButton>
<UnstyledButton
className={classes.control}
onClick={() => setActive('down-right')}
ref={setControlRef('down-right')}
mod={{ active: active === 'down-right' }}
>
<IconArrowDownRight size={26} stroke={1.5} />
</UnstyledButton>
</div>
</div>
);
}
colorsTuple function
New colorsTuple
function can be used to:
- Use single color as the same color for all shades
- Transform dynamic string arrays to Mantine color tuple (the array should still have 10 values)
import { colorsTuple, createTheme } from '@mantine/core';
const theme = createTheme({
colors: {
custom: colorsTuple('#FFC0CB'),
dynamic: colorsTuple(Array.from({ length: 10 }, (_, index) => '#FFC0CB')),
},
});
use-mutation-observer hook
New useMutationObserver hook:
import { useState } from 'react';
import { Kbd, Text } from '@mantine/core';
import { useMutationObserver } from '@mantine/hooks';
function Demo() {
const [lastMutation, setLastMutation] = useState('');
useMutationObserver(
(mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes' && mutation.attributeName === 'dir') {
mutation.target instanceof HTMLElement &&
setLastMutation(mutation.target.getAttribute('dir') || '');
}
});
...
7.6.2
What's Changed
[@mantine/hooks]
use-resize-observer: Fix types (#5847)[@mantine/hooks]
use-local-storage: Fixundefined
being written to the local storage whendefaultValue
is not defined (#5848)[@mantine/core]
NumberInput: FixonValueChange
not being called in increment/decrement functions (#5856)[@mantine/core]
InputWrapper: FixclassName
specified inlabelProps
,descriptionProps
anderrorProps
not being passed to the corresponding element (#5862)[@mantine/core]
Fix some functions not working correctly with TypeScript 5.4 (#5891)[@mantine/form]
FixonValuesChange
not using updated function (#5901)[@mantine/core]
Popover: Fix incorrect dropdown selectors (#5903)[@mantine/core]
Indicator: Fix processing animation in Safari (#5908)[@mantine/hooks]
use-headroom: Fix incorrect pinning logic when scrolling up (#5793)[@mantine/dropzone]
Add heic images format to default mime types (#5867)[@mantine/core]
Transition: Fix transitions resolving instantly in some cases (#5873)[@mantine/dropzone]
AddinputProps
prop support to pass props down to the underlying hidden input element (#5880)[@mantine/core]
Timeline: FixautoContrast
being passed to the dom node as attribute (#5890)
New Contributors
- @AdarshJais made their first contribution in #5833
- @Zachary-Kaye made their first contribution in #5890
- @redachl made their first contribution in #5867
- @timkrins made their first contribution in #5860
- @Alimobasheri made their first contribution in #5793
Full Changelog: 7.6.1...7.6.2
7.6.1
What's Changed
[@mantine/core]
Fix incorrect focus ring styles in Button.Group and ActionIcon.Group components (#5736)[@mantine/core]
Progress: Fix incorrect border-radius with multiple sections[@mantine/dates]
DateTimePicker: FixminDate
andmaxDate
not being respected in time input (#5819)[@mantine/core]
Switch: Userole="switch"
for better accessibility (#5746)[@mantine/hooks]
use-resize-observer: Fix incorrect ref type (#5780)[@mantine/dates]
FixpopoverProps.onClose
overriding original component value in DatePickerInput and other similar components (#4105)[@mantine/core]
Fix incorrect Escape key handling in Modal and Drawer components in some cases (#2827)[@mantine/core]
Combobox: Fix incorrect Escape key handling in Modal, Drawer and Popover[@mantine/core]
Transition: Fix transition resolving instantly in some cases (#3126, #5193)[@mantine/core]
Remove loader from the DOM ifloading
prop is not set on ActionIcon and Button components (#5795)[@mantine/hooks]
use-local-storage: Fix inconsistent default value persistence ifgetInitialValueInEffect
is set (#5796)[@mantine/core]
Select: FixautoComplete
prop not working (#5813)[@mantine/core]
Tabs: Fix incorrect border styles in outline variant[@mantine/core]
Checkbox: Fix incorrectindeterminate
+disabled
styles for outline variant (#5806)[@mantine/core]
SegmentedControl: Fix indicator state not being updated correctly when controlled state changes to a value that is not present in the data array (#5689)[@mantine/core]
Fix incorrect label offset with left label position in Checkbox, Switch and Radio components (#5823)[@mantine/core]
PinInput: Fix updating controlled value to an empty string working incorrectly[@mantine/core]
Menu: Fix incorrect role of dropdown elements
New Contributors
- @gl3nn made their first contribution in #5689
- @ktunador made their first contribution in #5711
- @snturk made their first contribution in #5819
Full Changelog: 7.6.0...7.6.1
7.6.0 π
View changelog with demos on mantine.dev website
Container queries support
You can now use container queries
with Mantine components. rem
and em
functions from postcss-preset-mantine
are available in container queries staring from [email protected]
.
.root {
min-width: rem(200px);
max-width: 100%;
min-height: rem(120px);
container-type: inline-size;
overflow: auto;
resize: horizontal;
}
.child {
background-color: var(--mantine-color-dimmed);
color: var(--mantine-color-white);
padding: var(--mantine-spacing-md);
@container (max-width: rem(500px)) {
background-color: var(--mantine-color-blue-filled);
}
@container (max-width: rem(300px)) {
background-color: var(--mantine-color-red-filled);
}
}
RadarChart component
New RadarChart component:
import { RadarChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
return (
<RadarChart
h={300}
data={multiData}
dataKey="product"
withPolarRadiusAxis
series={[
{ name: 'sales_january', color: 'lime.4', opacity: 0.1 },
{ name: 'sales_february', color: 'cyan.4', opacity: 0.1 },
]}
/>
);
}
FocusTrap.InitialFocus component
FocusTrap.InitialFocus is a new component that adds a visually hidden
element which will receive the focus when the focus trap is activated.
Once FocusTrap.InitialFocus
loses focus, it is removed from the tab order.
For example, it is useful if you do not want to focus any elements inside the Modal when it is opened:
import { Button, FocusTrap, Modal, TextInput } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
function Demo() {
const [opened, { open, close }] = useDisclosure(false);
return (
<>
<Modal opened={opened} onClose={close} title="Focus demo">
<FocusTrap.InitialFocus />
<TextInput label="First input" placeholder="First input" />
<TextInput
data-autofocus
label="Input with initial focus"
placeholder="It has data-autofocus attribute"
mt="md"
/>
</Modal>
<Button onClick={open}>Open modal</Button>
</>
);
}
New MantineProvider props
MantineProvider now includes more props to control how styles
are generated and injected. These props are useful if you use Mantine as a headless library
and in test environments.
deduplicateCssVariables
deduplicateCssVariables
prop determines whether CSS variables should be deduplicated: if CSS variable has the same value as in default theme, it is not added in the runtime.
By default, it is set to true
. If set to false
, all Mantine CSS variables will be added in <style />
tag
even if they have the same value as in the default theme.
import { MantineProvider } from '@mantine/core';
function Demo() {
return (
<MantineProvider deduplicateCssVariables={false}>
<App />
</MantineProvider>
);
}
withStaticClasses
withStaticClasses
determines whether components should have static classes, for example, mantine-Button-root
.
By default, static classes are enabled, to disable them set withStaticClasses
to false
:
import { MantineProvider } from '@mantine/core';
function Demo() {
return (
<MantineProvider withStaticClasses={false}>
<App />
</MantineProvider>
);
}
withGlobalClasses
withGlobalClasses
determines whether global classes should be added with <style />
tag.
Global classes are required for hiddenFrom
/visibleFrom
and lightHidden
/darkHidden
props to work.
By default, global classes are enabled, to disable them set withGlobalClasses
to false
. Note that
disabling global classes may break styles of some components.
import { MantineProvider } from '@mantine/core';
function Demo() {
return (
<MantineProvider withGlobalClasses={false}>
<App />
</MantineProvider>
);
}
HeadlessMantineProvider
HeadlessMantineProvider
is an alternative to MantineProvider
that should be used when you want to use Mantine as a headless UI library. It removes all
features that are related to Mantine styles:
- Mantine classes are not applied to components
- Inline CSS variables are not added with
style
attribute - All color scheme related features are removed
- Global styles are not generated
Limitations of HeadlessMantineProvider
:
- Color scheme switching will not work. If your application has a dark mode, you will need to implement it on your side.
- Props that are related to styles in all components (
color
,radius
,size
, etc.) will have no effect. - Some components that rely on styles will become unusable (Grid, SimpleGrid, Container, etc.).
lightHidden
/darkHidden
,visibleFrom
/hiddenFrom
props will not work.- Style props will work only with explicit values, for example
mt="xs"
will not work, butmt={5}
will.
To use HeadlessMantineProvider
, follow getting started guide and replace MantineProvider
with HeadlessMantineProvider
.
Note that you do not need to use ColorSchemeScript in your application, it will not have any effect,
you can ignore this part of the guide.
import { HeadlessMantineProvider } from '@mantine/core';
function App() {
return <HeadlessMantineProvider>{/* Your application */}</HeadlessMantineProvider>;
}
Sparkline trendColors
Sparkline now supports trendColors
prop to change chart color depending on the trend.
The prop accepts an object with positive
, negative
and neutral
properties:
positive
- color for positive trend (first value is less than the last value indata
array)negative
- color for negative trend (first value is greater than the last value indata
array)neutral
- color for neutral trend (first and last values are equal)
neutral
is optional, if not provided, the color will be the same as positive
.
import { Sparkline } from '@mantine/charts';
import { Stack, Text } from '@mantine/core';
const positiveTrend = [10, 20, 40, 20, 40, 10, 50];
const negativeTrend = [50, 40, 20, 40, 20, 40, 10];
const neutralTrend = [10, 20, 40, 20, 40, 10, 50, 5, 10];
function Demo() {
return (
<Stack gap="sm">
<Text>Positive trend:</Text>
<Sparkline
w={200}
h={60}
data={positiveTrend}
trendColors={{ positive: 'teal.6', negative: 'red.6', neutral: 'gray.5' }}
fillOpacity={0.2}
/>
<Text mt="md">Negative trend:</Text>
<Sparkline
w={200}
h={60}
data={negativeTrend}
trendColors={{ positive: 'teal.6', negative: 'red.6', neutral: 'gray.5' }}
fillOpacity={0.2}
/>
<Text mt="md">Neutral trend:</Text>
<Sparkline
w={200}
h={60}
data={neutralTrend}
trendColors={{ positive: 'teal.6', negative: 'red.6', neutral: 'gray.5' }}
fillOpacity={0.2}
/>
</Stack>
);
}
RichTextEditor tasks extension
RichTextEditor now supports tasks tiptap extension:
import TaskItem from '@tiptap/extension-task-item';
import { useEditor } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';
import { getTaskListExtension, RichTextEditor } from '@mantine/tiptap';
function Demo() {
const editor = useEditor({
extensions: [
StarterKit,
getTaskListExtension(TipTapTaskList),
TaskItem.configure({
nested: true,
HTMLAttributes: {
class: 'test-item',
},
}),
],
content: `
<ul data-type="taskList">
<li data-type="taskItem" data-checked="true">A list item</li>
<li data-type="taskItem" data-checked="false">And another one</li>
</ul>
`,
});
return (
<div style={{ padding: 40 }}>
<RichTextEditor editor={editor}>
<RichTextEditor.Toolbar>
<RichTextEditor.ControlsGroup>
<RichTextEditor.TaskList />
<RichTextEditor.TaskListLift />
<RichTextEditor.TaskListSink />
</RichTextEditor.ControlsGroup>
</RichTextEditor.Toolbar>
<RichTextEditor.Content />
</RichTextEditor>
</div>
);
}
renderOption prop
Select, MultiSelect, TagsInput and Autocomplete
components now support renderOption
prop that allows to customize option rendering:
import {
IconAlignCenter,
IconAlignJustified,
IconAlignLeft,
IconAlignRight,
IconCheck,
} from '@tabler/icons-react';
import { Group, Select, SelectProps } from '@mantine/core';
const iconProps = {
stroke: 1.5,
color: 'currentColor',
opacity: 0.6,
size: 18,
};
const icons: Record<string, React....
7.5.3
What's Changed
[@mantine/core]
NumberInput: Fix double border between controls appeared on low resolution screens (#5753)[@mantine/hooks]
use-hotkeys: Fix incorrectHotkeyItem
type (#5705)[@mantine/hooks]
use-resize-observer: Fix incorrect ref type (#5759)[@mantine/core]
ScrollArea: FixoffsetScrollbars
not working on y-axis (#5762)[@mantine/core]
NavLink: Addcollapse
Styles API selector (#5776)[@mantine/hooks]
Fixed initial value of theonline
attribute returned byuseNetwork()
in Firefox (#5766)[@mantine/core]
PinInput: Fix inputs not being updated withlength
prop changes[@mantine/core]
PinInput: Fix incorrectonComplete
behavior (#5774, #5771)[@mantine/core]
Card: Fix incorrect margins in first and last sections whenCardSection
component is used instead ofCard.Section
(#5742)[@mantine/core]
Tooltip: Fix multiline prop not working correctly inTooltip.Floating
component
New Contributors
- @nikolaistarostin made their first contribution in #5772
- @rilrom made their first contribution in #5762
Full Changelog: 7.5.2...7.5.3
7.5.2
What's Changed
[@mantine/core]
ActionIcon: Fix icon width and height defined in % not working correctly[@mantine/core]
ScrollArea: FixoffsetScrollbars
not working (#5733)[@mantine/tiptap]
FixinitialExternal
onRichTextEditor.Link
control not working correctly[@mantine/core]
FileInput: Fix incorrectextend
function type[@mantine/core]
PinInput: Fix various issues related to user input and pasting into the input (#5704)[@mantine/form]
Add callback argument support toform.setFieldValue
handler (#5696)[@mantine/core]
Add explicit extension to exports to support NodeNext TypeScript resolution (#5697)[@mantine/hooks]
use-list-state: Addswap
handler support (#5716)[@mantine/core]
Fix NodeNext TypeScript resolution not working correctly for PolymorphicComponentProps and PolymorphicRef types (#5730)[@mantine/core]
Fix cjs builds unable to resolve third-party dependencies with certain TypeScript settings (#5741)[@mantine/core]
Transition: Fix skew-up transition not working (#5714)[@mantine/core]
Select: Fix active option not being scrolled into view when the dropdown opens[@mantine/core]
Menu: Fix unexpected focus trap when keepMounted is false (#4502)[@mantine/core]
ScrollArea: Fixstyle
prop not being passed to the element when used inviewportProps
(#5594)[@mantine/core]
Divider: Fix poor color contrast with light color scheme[@mantine/core]
Modal: Fix incorrect content border-radius whenfullScreen
prop is set[@mantine/core]
Modal: Fix scroll container not working correctly when ScrollArea is used as a scroll container for a full screen modal[@mantine/notifications]
Fix notifications handlers not allowing passing data-* attributes (#5640)
New Contributors
- @kblcuk made their first contribution in #5741
- @qweered made their first contribution in #5694
- @kkaplita made their first contribution in #5704
Full Changelog: 7.5.1...7.5.2
7.5.1
What's Changed
[@mantine/core]
Indicator: Improve processing animation for lo-resolution monitors (#5682)[@mantine/hooks]
use-debounced-state: Fix incorrect type definition (#5665)[@mantine/hooks]
use-session-storage: Fix default value not being set in the storage on initial render (#5663)[@mantine/core]
Combobox: Fix incorrect dropdown styles with custom ScrollArea component (#5677)[@mantine/form]
Fix incorrect touch and dirty state handling inform.initialize
(#5623)[@mantine/core]
Chip: Fix error thrown when page is modified with Google Translate (#5586)[@mantine/form]
Add previous value as second argument toonValuesChange
(#5649)[@mantine/core]
FixautoContrast
defined on theme not working in some components (#5655)[@mantine/core]
Fix broken alignment in Checkbox, Radio and Switch (#5648)[@mantine/core-highlight]
AddwithCopyButton
prop support to CodeHighlightTabs (#5608)[@mantine/core]
UpdateuseComputedColorScheme
types to match definition with other similar hooks (#5588)[@mantine/core]
MultiSelect: Forbid select item removal if associated item becomes disabled (#5630)
New Contributors
- @Phirb made their first contribution in #5630
- @c0nd3v made their first contribution in #5588
- @sxflynn made their first contribution in #5605
- @vizath made their first contribution in #5648
- @mariansimecek made their first contribution in #5649
- @gabrielmaldi made their first contribution in #5670
- @waweber made their first contribution in #5668
- @msv96 made their first contribution in #5663
- @cristianghita24 made their first contribution in #5665
- @matthiasfeist made their first contribution in #5682
Full Changelog: 7.5.0...7.5.1
β¨ 7.5.0
View changelog with demos on mantine.dev website
DonutChart component
New DonutChart component:
import { DonutChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
return <DonutChart data={data} />;
}
PieChart component
New PieChart component:
import { PieChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
return <PieChart data={data} />;
}
@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"
:
import dayjs from 'dayjs';
import { useState } from 'react';
import { DateFormatter, DatePickerInput } from '@mantine/dates';
const formatter: DateFormatter = ({ type, date, locale, format }) => {
if (type === 'multiple' && Array.isArray(date)) {
if (date.length === 1) {
return dayjs(date[0]).locale(locale).format(format);
}
if (date.length > 1) {
return `${date.length} dates selected`;
}
return '';
}
return '';
};
function Demo() {
const [value, setValue] = useState<Date[]>([]);
return (
<DatePickerInput
label="Pick 2 dates or more"
placeholder="Pick 2 dates or more"
value={value}
onChange={setValue}
type="multiple"
valueFormatter={formatter}
/>
);
}
@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.
import { DatePicker, DatesProvider } from '@mantine/dates';
function Demo() {
return (
<DatesProvider settings={{ consistentWeeks: true }}>
<DatePicker />
</DatesProvider>
);
}
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.
import { AreaChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
return (
<AreaChart
h={300}
data={data}
dataKey="date"
type="stacked"
withLegend
legendProps={{ verticalAlign: 'bottom' }}
series={[
{ name: 'Apples', label: 'Apples sales', color: 'indigo.6' },
{ name: 'Oranges', label: 'Oranges sales', color: 'blue.6' },
{ name: 'Tomatoes', label: 'Tomatoes sales', color: 'teal.6' },
]}
/>
);
}
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.
import { AreaChart } from '@mantine/charts';
import { data } from './data';
function Demo() {
return (
<AreaChart
h={300}
data={data}
dataKey="date"
type="stacked"
valueFormatter={(value) => new Intl.NumberFormat('en-US').format(value)}
series={[
{ name: 'Apples', color: 'indigo.6' },
{ name: 'Oranges', color: 'blue.6' },
{ name: 'Tomatoes', color: 'teal.6' },
]}
/>
);
}
Headings text wrap
New Title textWrap
prop sets text-wrap
CSS property. It controls how text inside an element is wrapped.
import { Title } from '@mantine/core';
function Demo() {
return (
<Title order={3} textWrap="wrap">
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quasi voluptatibus inventore iusto
cum dolore molestiae perspiciatis! Totam repudiandae impedit maxime!
</Title>
);
}
You can also set textWrap
on theme:
import { createTheme, MantineProvider } 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 TypographyStylesProvider
mod prop
All components now support mod
prop, which allows adding data attributes to
the root element:
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
- New testing with Vitest guide
- NativeSelect with dividers demo
- Popover
shift
andflip
middlewares documentation - Combobox props related to Popover documentation
- Loading styles from CDN guide
- Anchor now includes additional documentation on how to use Text props
- Pagination now includes props tables for all compound components
- A more detailed breakdown of browser support has been added to the about page
Help center updates
New articles added to the help center:
- Can I use Mantine with Astro?
- How can I contribute to the library?
- How can I add dynamic CSS styles?
- How can I load fonts in Next.js?
- How can I load fonts in Vite?
- Is there a floating action button component?
- How to change inputs placeholder color?
- I do not have styles in my dates components...
Other changes
- Checkbox.Group, Radio.Group and Switch.Group now support
readOnly
prop - ActionIcon now has
loading
state animation - SegmentedControl now supports
withItemsBorder
prop which allows removing border between items - Progress now supports
transitionDuration
prop which controls section width animation duration - Textarea and JsonInput components now support
resize
prop, which allows settingresize
CSS property on the input @mantine/hooks
package now exports readLocalStorageValue and readSessionStorageValue function to get value from storage outside of React components