Version 3.3.0

Release date

ScrollArea component

New ScrollArea component lets you easily manage custom scrollbars without any external libraries:

Charizard (Pokémon)
Charizard description from Bulbapedia
Charizard is a draconic, bipedal Pokémon. It is primarily orange with a cream underside from the chest to the tip of its tail. It has a long neck, small blue eyes, slightly raised nostrils, and two horn-like structures protruding from the back of its rectangular head. There are two fangs visible in the upper jaw when its mouth is closed. Two large wings with blue-green undersides sprout from its back, and a horn-like appendage juts out from the top of the third joint of each wing. A single wing-finger is visible through the center of each wing membrane. Charizard's arms are short and skinny compared to its robust belly, and each limb has three white claws. It has stocky legs with cream-colored soles on each of its plantigrade feet. The tip of its long, tapering tail burns with a sizable flame.
As Mega Charizard X, its body and legs are more physically fit, though its arms remain thin. Its skin turns black with a sky-blue underside and soles. Two spikes with blue tips curve upward from the front and back of each shoulder, while the tips of its horns sharpen, turn blue, and curve slightly upward. Its brow and claws are larger, and its eyes are now red. It has two small, fin-like spikes under each horn and two more down its lower neck. The finger disappears from the wing membrane, and the lower edges are divided into large, rounded points. The third joint of each wing-arm is adorned with a claw-like spike. Mega Charizard X breathes blue flames out the sides of its mouth, and the flame on its tail now burns blue. It is said that its new power turns it black and creates more intense flames.
<ScrollArea style={{ height: 250 }}>
{/* ... content */}
</ScrollArea>

ScrollArea is now rendered as default dropdown element in Select, MultiSelect and TransferList components:

const data = Array(50)
.fill(0)
.map((_, index) => ({
value: `${index}`,
label: `Item ${index}`,
}));
<Select
label="What item is the best?"
placeholder="Pick one"
searchable
nothingFound="No options"
maxDropdownHeight={280}
data={data}
/>

use-form hook improvements

use-form hook now includes new getInputProps handler to simplify inputs

import { TextInput, Checkbox, Button } from '@mantine/core';
import { useForm } from '@mantine/hooks';
export function Demo() {
const form = useForm({
initialValues: {
email: '',
termsOfService: false,
},
validationRules: {
email: (value) => /^\S+@\S+$/.test(value),
},
});
return (
<form onSubmit={form.onSubmit((values) => console.log(values))}>
<TextInput
required
label="Email"
placeholder="your@email.com"
{...form.getInputProps('email')}
/>
<Checkbox
mt="md"
label="I agree to sell my privacy to this corporation"
{...form.getInputProps('termsOfService', { type: 'checkbox' })}
/>
<Button type="submit">Submit</Button>
</form>
);
}

Also use-form hook now supports optional error messages (hook will work as before if messages are not provided):

const form = useForm({
initialValues: { name: '', age: 0 },
validationRules: {
name: (value) => value.trim().length >= 2,
age: (value) => value > 21,
},
errorMessages: {
name: 'Name must include at least 2 characters',
age: 'You must be 21 or older to enter',
},
});
form.validate();
form.errors;
// -> { name: 'Name must include at least 2 characters', age: 'You must be 21 or older to enter' }
form.setFieldValue('name', 'John');
form.validate();
form.errors;
// -> { name: null, age: 'You must be 21 or older to enter' }

New features

Modal component can now be centered:

<Modal centered />

Accordion component now supports controlled state with useAccordionState hook:

Other changes

  • Components that use Popper (Select, Menu, DatePicker, etc.) now support an option to disable rendering within portal
  • Rich text editor now has an option to get editor ref, it can be used, for example, to focus/blur editor or to extend editor with plugins
  • Components that use Popper now support rendering without Portal by setting withinPortal={false}. This option is useful when you want to use Select and other components inside Popover or other components that use use-click-outside.
  • Accordion component now supports iconSize and offsetIcon props
  • Menu component now support disabled items
  • You can now change default locale that is used in all @mantine/dates components with dateLocale on MantineProvider

Bug fixes

  • Collapse component now works correctly with transitionDuration={0}
  • use-focus-trap hook is now less restrictive, it fixes issue with Popover and Menu scrolling page when being closed
  • Fix click outside not working with Modal with outside overflow
  • InputWrapper label now has display: inline-block styles, these styles will prevent input focusing when empty area above the input is clicked
  • Select component now correctly handles up and down arrow keys with selected value
  • Fix incorrect opened dropdown state in Select component when search results are empty and nothing found message is not provided
  • Fix incorrect enter key handling in Autocomplete, Select, MultiSelect and DatePicker components which resulted in unexpected form submits
  • Fix incorrect space key handling in Select and MultiSelect components
  • Fix focus shifting to input when date is selected with keyboard in DateRangePicker
Build fully functional accessible web applications faster than ever
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback