Version v10.0.0

Release date

Support Mantine development

You can now sponsor Mantine development with OpenCollective. All funds are used to improve Mantine and create new features and components.

Sponsor Mantine

Migration guide

This changelog covers breaking changes and new features in Mantine 10.0. To migrate your application to Mantine 10.0, follow 9.x → 10.x migration guide.

@mantine/data-grid package

New @mantine/data-grid package provides a data grid built on TanStack Table with sorting, filtering, pagination, editing, virtualization and server-side data:

Payment
ORD-1001Alice JohnsonMacBook Pro 16"$2,499
pending
Jan 1, 2024Credit Card
ORD-1002Bob TayloriPhone 15 Pro$1,212
processing
Jan 2, 2024PayPal
ORD-1003Carol GarciaAirPods Max$575
shipped
Jan 3, 2024Bank Transfer
ORD-1004David AlleniPad Air$838
delivered
Jan 4, 2024Credit Card
ORD-1005Eva EvansApple Watch Ultra$951
cancelled
Jan 5, 2024PayPal
ORD-1006Frank LongMacBook Air 15"$1,564
pending
Jan 6, 2024Bank Transfer
ORD-1007Grace WilliamsHomePod mini$177
processing
Jan 7, 2024Credit Card
ORD-1008Henry ThomasiPhone 15$990
shipped
Jan 8, 2024PayPal
ORD-1009Irene RobinsonMacBook Pro 14"$2,003
delivered
Jan 9, 2024Bank Transfer
ORD-1010James KingAirPods Pro$266
cancelled
Jan 10, 2024Credit Card
ORD-1011Karen GreeniPad Pro 13"$1,329
pending
Jan 11, 2024PayPal
ORD-1012Leo NelsonMac Studio$2,042
processing
Jan 12, 2024Bank Transfer
ORD-1013Mia DavisApple Watch SE$335
shipped
Jan 13, 2024Credit Card
ORD-1014Nathan WhiteAirTag 4-Pack$168
delivered
Jan 14, 2024PayPal
ORD-1015Olivia LewisMagic Keyboard$381
cancelled
Jan 15, 2024Bank Transfer
ORD-1016Patrick AdamsStudio Display$1,694
pending
Jan 16, 2024Credit Card
ORD-1017Quinn IrvingiPhone 15 Pro Max$1,407
processing
Jan 17, 2024PayPal
ORD-1018Rachel ParkeriPad mini$520
shipped
Jan 18, 2024Bank Transfer
ORD-1019Sam WilsonMacBook Air 13"$1,133
delivered
Jan 19, 2024Credit Card
ORD-1020Tina MartinAirPods 4$226
cancelled
Jan 20, 2024PayPal
import { useState } from 'react';
import { Badge, Button, Group, NumberFormatter, NumberInput, Popover, Select, Stack } from '@mantine/core';
import { DataGrid, DataGridStore, useDataGrid } from '@mantine/data-grid';
import { orders, statusColors } from './data';
import type { Order } from './data';

function FiltersPopover({ store }: { store: DataGridStore<Order> }) {
  const [opened, setOpened] = useState(false);
  const activeCount = store.getColumnFilters().length;
  const amount = (store.getColumnFilterValue('amount') as [number?, number?] | undefined) ?? [];

  const setAmount = (index: 0 | 1, value: string | number) => {
    const next: [number?, number?] = [amount[0], amount[1]];
    next[index] = typeof value === 'number' ? value : undefined;
    store.setColumnFilter('amount', next[0] == null && next[1] == null ? undefined : next);
  };

  return (
    <Popover opened={opened} onChange={setOpened} position="bottom-start" shadow="md">
      <Popover.Target>
        <Button
          variant="default"
          size={store.getControlSize()}
          onClick={() => setOpened((o) => !o)}
          rightSection={
            activeCount > 0 ? (
              <Badge size="xs" circle>
                {activeCount}
              </Badge>
            ) : null
          }
        >
          Filters
        </Button>
      </Popover.Target>
      <Popover.Dropdown>
        <Stack gap="sm" w={260}>
          <Select
            label="Status"
            placeholder="All statuses"
            clearable
            size="xs"
            data={store.getFacetedUniqueValues('status')}
            value={(store.getColumnFilterValue('status') as string) ?? null}
            onChange={(value) => store.setColumnFilter('status', value)}
          />
          <Select
            label="Payment"
            placeholder="All methods"
            clearable
            size="xs"
            data={store.getFacetedUniqueValues('method')}
            value={(store.getColumnFilterValue('method') as string) ?? null}
            onChange={(value) => store.setColumnFilter('method', value)}
          />
          <Group grow gap="xs">
            <NumberInput
              label="Min amount"
              placeholder="Min"
              size="xs"
              prefix="$"
              value={amount[0] ?? ''}
              onChange={(value) => setAmount(0, value)}
            />
            <NumberInput
              label="Max amount"
              placeholder="Max"
              size="xs"
              prefix="$"
              value={amount[1] ?? ''}
              onChange={(value) => setAmount(1, value)}
            />
          </Group>
          <Group justify="flex-end">
            <Button
              size="xs"
              variant="default"
              disabled={activeCount === 0}
              onClick={() => store.resetColumnFilters()}
            >
              Clear all
            </Button>
          </Group>
        </Stack>
      </Popover.Dropdown>
    </Popover>
  );
}

function Demo() {
  const store = useDataGrid({
    data: orders,
    columns: [
      { accessorKey: 'id', header: 'Order', size: 110, enableSorting: true },
      { accessorKey: 'customer', header: 'Customer', size: 160, enableSorting: true },
      { accessorKey: 'product', header: 'Product', size: 180, enableSorting: true },
      {
        accessorKey: 'amount',
        header: 'Amount',
        size: 120,
        enableSorting: true,
        filterFn: 'inNumberRange',
        meta: { align: 'end' },
        cell: ({ getValue }) => (
          <NumberFormatter
            value={getValue() as number}
            prefix="$"
            thousandSeparator
            decimalScale={2}
          />
        ),
      },
      {
        accessorKey: 'status',
        header: 'Status',
        size: 130,
        enableSorting: true,
        filterFn: 'equals',
        cell: ({ getValue }) => {
          const status = getValue() as Order['status'];
          return (
            <Badge variant="filled" color={statusColors[status]} size="sm">
              {status}
            </Badge>
          );
        },
      },
      {
        accessorKey: 'date',
        header: 'Date',
        size: 120,
        enableSorting: true,
        cell: ({ getValue }) =>
          new Date(getValue() as string).toLocaleDateString('en-US', {
            month: 'short',
            day: 'numeric',
            year: 'numeric',
          }),
      },
      { accessorKey: 'method', header: 'Payment', size: 130, filterFn: 'equals' },
    ],
    getRowId: (row) => row.id,
    withGlobalFilter: true,
    withRowSelection: true,
    withColumnVisibility: true,
    withFaceting: true,
    pageSize: 20,
  });

  return (
    <DataGrid store={store} highlightOnHover>
      <DataGrid.Toolbar>
        <DataGrid.GlobalFilter placeholder="Search orders..." />
        <FiltersPopover store={store} />
        <div style={{ flex: 1 }} />
        <DataGrid.ColumnVisibilityToggle />
        <DataGrid.ExportButton fileName="orders" />
      </DataGrid.Toolbar>
      <DataGrid.SelectionBar>
        <Button size={store.getControlSize()} variant="default">
          Mark as shipped
        </Button>
        <Button size={store.getControlSize()} variant="default">
          Cancel orders
        </Button>
      </DataGrid.SelectionBar>
      <DataGrid.Footer statusFormat="long" />
    </DataGrid>
  );
}

ImageCropper component

New ImageCropper lets users pan, zoom, rotate and flip an image inside a rectangular or circular crop window. Export the crop as a Blob or data URL, or use its coordinates to crop the image on the server:

import { ImageCropper } from '@mantine/core';

const image = 'https://raw.githubusercontent.com/mantinedev/mantine/master/.demo/images/bg-9.png';

function Demo() {
  return (
    <ImageCropper
      src={image}
      crossOrigin="anonymous"
      maw={360}
      mx="auto"
      withControls
    />
  );
}

Timer component

New Timer displays a countdown or stopwatch with controls to pause, resume and restart it. Use useTimer on its own or build a custom layout with Timer:

0500
import { ActionIcon, Group, Timer } from '@mantine/core';
import { ArrowCounterClockwiseIcon, PauseIcon, PlayIcon } from '@phosphor-icons/react';

function Demo() {
  return (
    <Timer countdown startMs={5 * 60 * 1000} autoStart>
      <Group gap={4} fz={36} fw={700}>
        <Timer.Segment type="minutes" />
        <Timer.Separator>:</Timer.Separator>
        <Timer.Segment type="seconds" />
      </Group>

      <Group gap="xs">
        <Timer.Control action="start" aria-label="Start">
          <ActionIcon component="span" variant="light">
            <PlayIcon size={18} weight="fill" />
          </ActionIcon>
        </Timer.Control>
        <Timer.Control action="pause" aria-label="Pause">
          <ActionIcon component="span" variant="light">
            <PauseIcon size={18} weight="fill" />
          </ActionIcon>
        </Timer.Control>
        <Timer.Control action="restart" aria-label="Restart">
          <ActionIcon component="span" variant="light">
            <ArrowCounterClockwiseIcon size={18} />
          </ActionIcon>
        </Timer.Control>
      </Group>
    </Timer>
  );
}

Editable component

New Editable lets users edit text in place. Press Enter to save or Escape to cancel, or add buttons for both actions:

Project name
import { ActionIcon, Editable, Group } from '@mantine/core';
import { CheckIcon, PencilSimpleIcon, XIcon } from '@phosphor-icons/react';

function Demo() {
  return (
    <Editable defaultValue="Project name" activationMode="none">
      <Group gap="xs">
        <Editable.Preview />
        <Editable.Input />
        <Editable.Control>
          <Editable.EditTrigger aria-label="Edit">
            <ActionIcon component="span" variant="default">
              <PencilSimpleIcon size={16} />
            </ActionIcon>
          </Editable.EditTrigger>
          <Editable.SubmitTrigger aria-label="Save">
            <ActionIcon component="span" variant="default">
              <CheckIcon size={16} />
            </ActionIcon>
          </Editable.SubmitTrigger>
          <Editable.CancelTrigger aria-label="Cancel">
            <ActionIcon component="span" variant="default">
              <XIcon size={16} />
            </ActionIcon>
          </Editable.CancelTrigger>
        </Editable.Control>
      </Group>
    </Editable>
  );
}

FileSize component

New FileSize displays a byte count in a readable format, such as 1.45 kB. Use formatBytes to get the same localized value as a string:

FileSize
avatar.png15.36 kB
report.pdf1.45 MB
backup.zip4.8 GB
import { FileSize, Table } from '@mantine/core';

const files = [
  { name: 'avatar.png', size: 15360 },
  { name: 'report.pdf', size: 1_450_000 },
  { name: 'backup.zip', size: 4_800_000_000 },
];

function Demo() {
  return (
    <Table>
      <Table.Thead>
        <Table.Tr>
          <Table.Th>File</Table.Th>
          <Table.Th>Size</Table.Th>
        </Table.Tr>
      </Table.Thead>
      <Table.Tbody>
        {files.map((file) => (
          <Table.Tr key={file.name}>
            <Table.Td>{file.name}</Table.Td>
            <Table.Td>
              <FileSize value={file.size} />
            </Table.Td>
          </Table.Tr>
        ))}
      </Table.Tbody>
    </Table>
  );
}

CodeHighlightFileTree component

New CodeHighlightFileTree component displays multi-file code with a file tree instead of tabs. / in fileName creates folders, the active file can be controlled with activeFile and onActiveFileChange props, and below hideTreeBelow breakpoint the tree is replaced with a select:

  • steps
    • address
      • AddressStep.tsx
      • countries.json
    • PersonalStep.tsx
    • PersonalStep.module.css
  • assets
    • logo.svg
  • JobApplicationForm.tsx
  • JobApplicationForm.module.css
  • types.ts
  • validation.ts
  • README.md
  • JobApplicationForm.test.tsx
import { Button, Group, Stepper } from '@mantine/core';
import { useForm } from '@mantine/form';
import { AddressStep } from './steps/address/AddressStep';
import { PersonalStep } from './steps/PersonalStep';
import { validation } from './validation';
import type { JobApplicationValues } from './types';
import classes from './JobApplicationForm.module.css';

export function JobApplicationForm() {
  const form = useForm<JobApplicationValues>({
    mode: 'uncontrolled',
    initialValues: { name: '', email: '', street: '', city: '', country: '' },
    validate: validation,
  });

  return (
    <form className={classes.root} onSubmit={form.onSubmit(console.log)}>
      <Stepper active={0}>
        <Stepper.Step label="Personal">
          <PersonalStep form={form} />
        </Stepper.Step>
        <Stepper.Step label="Address">
          <AddressStep form={form} />
        </Stepper.Step>
      </Stepper>

      <Group justify="flex-end" mt="md">
        <Button type="submit">Submit</Button>
      </Group>
    </form>
  );
}
import { CodeHighlightFileTree } from '@mantine/code-highlight';
import { fileTreeCode } from './data';
import { getFileIcon, getFolderIcon } from './icons';

function Demo() {
  return (
    <CodeHighlightFileTree
      code={fileTreeCode}
      getFileIcon={getFileIcon}
      getFolderIcon={getFolderIcon}
      radius="md"
      withBorder
    />
  );
}

Component controllers and stores

Use a controller to trigger component actions from your own controls. For example, useAccordion lets a button expand all items:

Expanded: none

import { Accordion, Button, Group, Text, useAccordion } from '@mantine/core';
import { data } from './data';

function Demo() {
  const controller = useAccordion({ multiple: true });

  const items = data.map((item) => (
    <Accordion.Item key={item.value} value={item.value}>
      <Accordion.Control icon={item.emoji}>{item.value}</Accordion.Control>
      <Accordion.Panel>{item.description}</Accordion.Panel>
    </Accordion.Item>
  ));

  return (
    <>
      <Group justify="center" mb="md">
        <Button onClick={controller.expandAll}>Expand all</Button>
        <Button variant="default" onClick={controller.collapseAll}>
          Collapse all
        </Button>
        <Button variant="default" onClick={() => controller.toggle('Bananas')}>
          Toggle bananas
        </Button>
      </Group>

      <Accordion controller={controller} order={3}>
        {items}
      </Accordion>

      <Text ta="center" mt="md" size="sm" c="dimmed">
        Expanded: {controller.getExpandedItems().join(', ') || 'none'}
      </Text>
    </>
  );
}

Use a store to build on an existing component. For example, useSelect lets you build a select that creates new options:

import { useState } from 'react';
import { Select, SelectProps, useSelect } from '@mantine/core';

interface CreatableSelectProps extends Omit<SelectProps, 'data' | 'store' | 'renderOption'> {
  data: string[];
  onCreate: (item: string) => void;
}

function CreatableSelect({ data, onCreate, value, defaultValue, onChange, ...others }: CreatableSelectProps) {
  const store = useSelect({
    value,
    defaultValue,
    onChange: (item, option) => {
      if (item !== null && !data.includes(item)) {
        onCreate(item);
      }

      onChange?.(item, option);
    },
  });

  const search = store.getSearch().trim();
  const canCreate = search !== '' && !data.includes(search);

  return (
    <Select
      {...others}
      store={store}
      searchable
      data={canCreate ? [...data, search] : data}
      renderOption={({ option }) =>
        data.includes(option.value) ? option.label : `+ Create ${option.label}`
      }
    />
  );
}

function Demo() {
  const [data, setData] = useState(['Apples', 'Bananas', 'Broccoli', 'Carrots', 'Chocolate']);

  return (
    <CreatableSelect
      label="Your favorite grocery"
      placeholder="Search or create"
      data={data}
      onCreate={(item) => setData((current) => [...current, item])}
    />
  );
}

Theme editor

New theme editor lets you build a theme from ready-made presets and preview it on real pages. Adjust colors, fonts, spacing and shadows, then copy the theme code or a prompt for your coding agent.

Open the Mantine theme editor

OKLCH default palettes

Default colors are regenerated in the OKLCH color space: shades with the same index now look equally bright in every color. Existing color names and the number of shades are unchanged, see the migration guide if you parse --mantine-color-* variables.

Colors generator

generateColors from @mantine/colors-generator now returns OKLCH colors and keeps the input color in the palette. The second argument adjusts lightness, saturation and hue of the generated shades, see colors generation. The online tool moved to themes.mantine.dev/colors-generator, it has presets and a separate palette for dark color scheme:

import { createTheme } from '@mantine/core';
import { generateColors } from '@mantine/colors-generator';

const theme = createTheme({
  colors: {
    brand: generateColors('#375EAC', { baseShade: 7, hueShift: 10 }),
  },
});

Neutral color

New neutral color is black in light mode and white in dark mode. Use color="neutral" on individual components or set primaryColor: 'neutral' in your theme:

import { Button, Group } from '@mantine/core';

function Demo() {
  return (
    <Group>
      <Button color="neutral" variant="filled">Filled</Button>
      <Button color="neutral" variant="light">Light</Button>
      <Button color="neutral" variant="outline">Outline</Button>
      <Button color="neutral" variant="subtle">Subtle</Button>
      <Button color="neutral" variant="transparent">Transparent</Button>
      <Button color="neutral" variant="white">White</Button>
    </Group>
  );
}

Neutral color ladder

New --mantine-color-neutral-0 to --mantine-color-neutral-9 variables adapt to the color scheme. Use them in custom CSS instead of separate gray and dark shades:

.card {
  background-color: var(--mantine-color-neutral-1);
  border: 1px solid var(--mantine-color-border);
}

Dark neutral flavors

New darkColdColors, darkWarmColors and darkTintedColors palettes change the tone of the dark color scheme. Assign one of them to theme.colors.dark:

import { createTheme, darkWarmColors } from '@mantine/core';

const theme = createTheme({
  colors: {
    dark: darkWarmColors,
  },
});

Neutral shades tint

New grayWarmColors and grayColdColors palettes provide warm and cold neutrals for the light color scheme. Use mixNeutralColors from @mantine/colors-generator to blend your primary color into neutral shades:

import { mixNeutralColors } from '@mantine/colors-generator';
import {
  createTheme,
  darkWarmColors,
  DEFAULT_THEME,
  grayWarmColors,
} from '@mantine/core';

const tint = DEFAULT_THEME.colors.blue[6];

const theme = createTheme({
  colors: {
    dark: mixNeutralColors(darkWarmColors, tint, 8),
    gray: mixNeutralColors(grayWarmColors, tint, 3.2),
  },
});

tintColors utility

New tintColors function mixes a color into every shade of the dark palette:

import { createTheme, darkColors, tintColors } from '@mantine/core';

const theme = createTheme({
  colors: {
    dark: tintColors(darkColors, '#5c7cfa', 0.15),
  },
});

Semantic color CSS variables

Override semantic color variables to restyle components together. For example, change every focus ring in dark mode:

[data-mantine-color-scheme='dark'] {
  --mantine-color-focus-ring: var(--mantine-color-lime-4);
}

Surface component

New Surface component replaces Paper, which is deprecated and will be removed in 11.0. Nested surfaces step up one level automatically, so elevation is visible in dark mode:

import { Surface } from '@mantine/core';

function Demo() {
  return (
    <Surface p="md" withBorder>
      Outer surface
      <Surface p="md">Inner surface, one level higher</Surface>
    </Surface>
  );
}

Use the surfaces theme key to change surface colors for each color scheme:

import { createTheme } from '@mantine/core';

const theme = createTheme({
  surfaces: {
    dark: {
      panel: '#101113',
    },
  },
});

Inputs share one surface token

Inputs, checkboxes, radios, Dropzone and RichTextEditor now share the --mantine-color-surface-input variable, which is white in light mode and dark-7 in dark mode. The editor matches the other inputs, and one override restyles all of them. Change it with the surfaces theme key:

import { createTheme } from '@mantine/core';

const theme = createTheme({
  surfaces: {
    dark: {
      input: 'var(--mantine-color-dark-8)',
    },
  },
});

Dropdowns render on the page surface

Dropdowns of Popover, Menu and Combobox based components now use the page background, like Modal. In dark mode they are darker than before and are separated from the content with a border and a shadow.

Sunken surfaces, code surfaces and control tracks

Segmented controls, contained tabs and scrollbars now share one sunken surface color. Code elements share one muted surface color, and tracks of switches, sliders and progress bars use the new --mantine-color-track variable.

autoContrast enabled by default

Filled components now pick black or white text to match their background color. Set autoContrast: false in the theme to restore the previous behavior.

Disabled state opacity

Disabled components now look like a faded version of their normal state instead of turning gray. Change the opacity with theme.disabledOpacity:

Disabled opacity
import { MantineProvider, Button, Checkbox, Switch, TextInput } from '@mantine/core';

function Demo() {
  return (
    <MantineProvider theme={{ disabledOpacity: undefined }}>
      <Button disabled>Disabled button</Button>
      <TextInput mt="md" label="Disabled input" placeholder="Disabled input" disabled />
      <Checkbox mt="md" label="Disabled checkbox" defaultChecked disabled />
      <Switch mt="md" label="Disabled switch" defaultChecked disabled />
    </MantineProvider>
  );
}

use-form engine and uncontrolled mode

useForm is now uncontrolled by default. Typing rerenders only the input, not the whole form, and form.key() is no longer needed:

import { TextInput } from '@mantine/core';
import { useForm } from '@mantine/form';

function Demo() {
  const form = useForm({ initialValues: { email: '' } });
  return <TextInput label="Email" {...form.getInputProps('email')} />;
}

New form.useDirty and form.useTouched hooks subscribe a component to dirty and touched state, and custom inputs subscribe to a field with the useFormField hook. See uncontrolled mode for details.

Reusable form fields

New form.getField('path') returns a field object with the same type as useField. A component that accepts it works with any form, see reusable fields:

import { TextInput } from '@mantine/core';
import { useField, useForm, UseFieldReturnType } from '@mantine/form';

function EmailField({ field }: { field: UseFieldReturnType<string> }) {
  return <TextInput label="Email" {...field.getInputProps()} />;
}

function Demo() {
  const signup = useForm({ initialValues: { email: '' } });
  const checkout = useForm({ initialValues: { contact: { email: '' } } });
  const newsletter = useField({ initialValue: '' });

  return (
    <>
      <EmailField field={signup.getField('email')} />
      <EmailField field={checkout.getField('contact.email')} />
      <EmailField field={newsletter} />
    </>
  );
}
Open reusable fields example

Conditional validation

New when validator runs a rule only when the condition returns true. Use it for fields that are required depending on another field, see validators:

import { isNotEmpty, useForm, when } from '@mantine/form';

const form = useForm({
  initialValues: { isCompany: false, companyName: '' },
  validate: {
    companyName: when(
      (values) => values.isCompany,
      isNotEmpty('Company name is required')
    ),
  },
});

Focus form inputs

form.focusInput(path) focuses an input or a control inside a group, such as Radio.Group. Use it to focus the first invalid field on submit, see form submission:

Preferred contact
import { Button, Group, Radio, TextInput } from '@mantine/core';
import { isEmail, isNotEmpty, useForm } from '@mantine/form';

function Demo() {
  const form = useForm({
    name: 'register-form',
    initialValues: {
      name: '',
      email: '',
      contact: '',
    },

    validate: {
      name: isNotEmpty('Name is required'),
      email: isEmail('Invalid email'),
      contact: isNotEmpty('Choose how to contact you'),
    },
  });

  return (
    <form
      onSubmit={form.onSubmit(
        (values) => console.log(values),
        (errors) => {
          const firstErrorPath = Object.keys(errors)[0];
          form.focusInput(firstErrorPath);
        }
      )}
    >
      <TextInput
        withAsterisk
        label="Your name"
        placeholder="Your name"
        {...form.getInputProps('name')}
      />

      <TextInput
        withAsterisk
        label="Your email"
        placeholder="your@email.com"
        mt="md"
        {...form.getInputProps('email')}
      />

      <Radio.Group label="Preferred contact" withAsterisk mt="md" {...form.getInputProps('contact')}>
        <Radio label="Email" value="email" />
        <Radio label="Phone" value="phone" />
      </Radio.Group>

      <Group justify="flex-end" mt="md">
        <Button type="submit">Submit</Button>
      </Group>
    </form>
  );
}

Virtualized combobox dropdowns

Pass a virtualizer component to render large dropdowns with the scrolling library of your choice. It works with the following components:

This Autocomplete lets you search and navigate 10,000 options while rendering only the visible rows:

import { Autocomplete } from '@mantine/core';
import { VirtualList } from './VirtualList';

const data = Array.from({ length: 10000 }, (_, index) => `Option ${index + 1}`);

function Demo() {
  return (
    <Autocomplete
      label="Search 10,000 options"
      placeholder="Type an option number"
      data={data}
      virtualizer={VirtualList}
    />
  );
}

Mobile-friendly dates dropdowns

Date picker inputs and DateTimePicker now open in a bottom drawer on small screens. Use dropdownType prop to choose the dropdown type for each breakpoint:

import { Stack } from '@mantine/core';
import { DatePickerInput } from '@mantine/dates';

function Demo() {
  return (
    <Stack>
      <DatePickerInput dropdownType="drawer" label="Drawer" placeholder="Pick date" />
      <DatePickerInput dropdownType="modal" label="Modal" placeholder="Pick date" />
      <DatePickerInput dropdownType="popover" label="Popover" placeholder="Pick date" />
      <DatePickerInput
        dropdownType={{ base: 'drawer', 600: 'popover' }}
        label="Drawer below 600px, popover above"
        placeholder="Pick date"
      />
    </Stack>
  );
}

In drawer and modal dropdowns, the value is applied when the user presses the submit button. Set applyOnSubmit={false} to apply it on selection:

import { DatePickerInput } from '@mantine/dates';

function Demo() {
  return (
    <DatePickerInput
      dropdownType="drawer"
      applyOnSubmit={false}
      label="Applied on selection"
      placeholder="Pick date"
    />
  );
}

DateTimePicker uses the native time input in the drawer:

import { Stack } from '@mantine/core';
import { DateTimePicker } from '@mantine/dates';

function Demo() {
  return (
    <Stack>
      <DateTimePicker dropdownType="drawer" label="Drawer" placeholder="Pick date and time" />
      <DateTimePicker dropdownType="modal" label="Modal" placeholder="Pick date and time" />
      <DateTimePicker dropdownType="popover" label="Popover" placeholder="Pick date and time" />
      <DateTimePicker
        dropdownType={{ base: 'drawer', 600: 'popover' }}
        label="Drawer below 600px, popover above"
        placeholder="Pick date and time"
      />
    </Stack>
  );
}

Dropzone upload progress

Dropzone now supports the progress prop to display upload progress inside the dropzone. While it is set, the dropzone is disabled and Dropzone.Uploading is displayed instead of Dropzone.Idle:

Drag images here or click to select files

import { useEffect, useRef, useState } from 'react';
import { CloudArrowUpIcon, ImageIcon, UploadSimpleIcon, XIcon } from '@phosphor-icons/react';
import { Group, Text } from '@mantine/core';
import { Dropzone, FileWithPath, IMAGE_MIME_TYPE } from '@mantine/dropzone';

function Demo() {
  const [progress, setProgress] = useState<number | undefined>(undefined);
  const interval = useRef<number>(undefined);

  useEffect(() => () => window.clearInterval(interval.current), []);

  const upload = (files: FileWithPath[]) => {
    if (files.length === 0) {
      return;
    }

    let uploaded = 0;
    setProgress(uploaded);

    interval.current = window.setInterval(() => {
      uploaded += 10;

      if (uploaded > 100) {
        window.clearInterval(interval.current);
        setProgress(undefined);
      } else {
        setProgress(uploaded);
      }
    }, 200);
  };

  return (
    <Dropzone
      accept={IMAGE_MIME_TYPE}
      onDrop={upload}
      progress={progress}
      progressProps={{ 'aria-label': 'Upload progress' }}
    >
      <Group justify="center" gap="xl" mih={220} style={{ pointerEvents: 'none' }}>
        <Dropzone.Accept>
          <UploadSimpleIcon size={52} color="var(--mantine-color-blue-6)" />
        </Dropzone.Accept>

        <Dropzone.Reject>
          <XIcon size={52} color="var(--mantine-color-red-6)" />
        </Dropzone.Reject>

        <Dropzone.Idle>
          <ImageIcon size={52} color="var(--mantine-color-dimmed)" />
        </Dropzone.Idle>

        <Dropzone.Uploading>
          <CloudArrowUpIcon size={52} color="var(--mantine-color-blue-6)" />
        </Dropzone.Uploading>

        <Text size="xl" inline>
          {progress === undefined
            ? 'Drag images here or click to select files'
            : `Uploading… ${progress}%`}
        </Text>
      </Group>
    </Dropzone>
  );
}

Modal and Drawer updates

Use Modal.Footer or Drawer.Footer to keep actions visible while the body scrolls. Set stickyHeader={false} or stickyFooter={false} to scroll that section with the content:

import { useDisclosure } from '@mantine/hooks';
import { Modal, Button, Group, Text } from '@mantine/core';

function Demo() {
  const [opened, { open, close }] = useDisclosure(false);

  return (
    <>
      <Modal.Root opened={opened} onClose={close}>
        <Modal.Overlay />
        <Modal.Content>
          <Modal.Header>
            <Modal.Title>Terms of service</Modal.Title>
            <Modal.CloseButton />
          </Modal.Header>

          <Modal.Body>
            {Array.from({ length: 20 }).map((_, index) => (
              <Text key={index} mb="md">
                Scroll the body to see that the header stays pinned to the top and the footer
                stays pinned to the bottom.
              </Text>
            ))}
          </Modal.Body>

          <Modal.Footer>
            <Group justify="flex-end" w="100%">
              <Button variant="default" onClick={close}>
                Decline
              </Button>
              <Button onClick={close}>Accept</Button>
            </Group>
          </Modal.Footer>
        </Modal.Content>
      </Modal.Root>

      <Button variant="default" onClick={open}>
        Open modal
      </Button>
    </>
  );
}

Modal.Stack and Drawer.Stack now keep earlier overlays visible behind the top one. Set maxDepth to choose how many stay visible:

import { Button, Group, Modal, useModalsStack } from '@mantine/core';

function Demo() {
  const stack = useModalsStack(['delete-page', 'confirm-action', 'really-confirm-action']);

  return (
    <>
      <Modal.Stack>
        <Modal {...stack.register('delete-page')} title="Delete this page?">
          Are you sure you want to delete this page? This action cannot be undone.
          <Group mt="lg" justify="flex-end">
            <Button onClick={stack.closeAll} variant="default">
              Cancel
            </Button>
            <Button onClick={() => stack.open('confirm-action')} color="red">
              Delete
            </Button>
          </Group>
        </Modal>

        <Modal {...stack.register('confirm-action')} title="Confirm action">
          Are you sure you want to perform this action? This action cannot be undone. If you are
          sure, press confirm button below.
          <Group mt="lg" justify="flex-end">
            <Button onClick={stack.closeAll} variant="default">
              Cancel
            </Button>
            <Button onClick={() => stack.open('really-confirm-action')} color="red">
              Confirm
            </Button>
          </Group>
        </Modal>

        <Modal {...stack.register('really-confirm-action')} title="Really confirm action">
          Jokes aside. You have confirmed this action. This is your last chance to cancel it. After
          you press confirm button below, action will be performed and cannot be undone. For real
          this time. Are you sure you want to proceed?
          <Group mt="lg" justify="flex-end">
            <Button onClick={stack.closeAll} variant="default">
              Cancel
            </Button>
            <Button onClick={stack.closeAll} color="red">
              Confirm
            </Button>
          </Group>
        </Modal>
      </Modal.Stack>

      <Button variant="default" onClick={() => stack.open('delete-page')}>
        Open modal
      </Button>
    </>
  );
}

Automatic Modal and Drawer stacking

Set overlayStack in the theme to stack all modals and drawers without Modal.Stack wrappers:

import { createTheme } from '@mantine/core';

const theme = createTheme({
  overlayStack: true,
});
import { Button, Group, Modal, useModalStackContext } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';

function Demo() {
  const [deleteOpened, deleteHandlers] = useDisclosure(false);
  const [confirmOpened, confirmHandlers] = useDisclosure(false);
  const stack = useModalStackContext();

  return (
    <>
      <Modal opened={deleteOpened} onClose={deleteHandlers.close} title="Delete this page?">
        Are you sure you want to delete this page? This action cannot be undone.
        <Group mt="lg" justify="flex-end">
          <Button onClick={deleteHandlers.close} variant="default">
            Cancel
          </Button>
          <Button onClick={confirmHandlers.open} color="red">
            Delete
          </Button>
        </Group>
      </Modal>

      <Modal opened={confirmOpened} onClose={confirmHandlers.close} title="Confirm action">
        Are you sure you want to perform this action? This action cannot be undone. If you are
        sure, press confirm button below.
        <Group mt="lg" justify="flex-end">
          <Button onClick={stack.closeAll} variant="default">
            Cancel
          </Button>
          <Button onClick={stack.closeAll} color="red">
            Confirm
          </Button>
        </Group>
      </Modal>

      <Button variant="default" onClick={deleteHandlers.open}>
        Open modal
      </Button>
    </>
  );
}

useModal and useDrawer hooks

New useModal and useDrawer hooks open a modal or a drawer without rendering it in JSX:

import { useState } from 'react';
import { Button, Group, Text, useModal } from '@mantine/core';

function Demo() {
  const [count, setCount] = useState(0);
  const modal = useModal({
    title: `Count: ${count}`,
    children: (
      <>
        <Text mb="md">The modal is updated every time the parent component renders: {count}</Text>
        <Button fullWidth onClick={() => setCount((c) => c + 1)}>
          Increment
        </Button>
      </>
    ),
  });

  return (
    <Group justify="center">
      <Button onClick={() => modal.open()}>Open modal</Button>
      <Button variant="default" onClick={() => setCount((c) => c + 1)}>
        Increment ({count})
      </Button>
    </Group>
  );
}

Pass props to open to change the content or settings for one opening:

import { useState } from 'react';
import { Button, Group, Text, useDrawer } from '@mantine/core';

function Demo() {
  const [count, setCount] = useState(0);
  const drawer = useDrawer({
    title: `Count: ${count}`,
    position: 'right',
    children: (
      <>
        <Text mb="md">The drawer is updated every time the parent component renders: {count}</Text>
        <Button fullWidth onClick={() => setCount((c) => c + 1)}>
          Increment
        </Button>
      </>
    ),
  });

  return (
    <Group justify="center">
      <Button onClick={() => drawer.open()}>Open drawer</Button>
      <Button variant="default" onClick={() => drawer.open({ position: 'left' })}>
        Open on the left
      </Button>
      <Button variant="default" onClick={() => setCount((c) => c + 1)}>
        Increment ({count})
      </Button>
    </Group>
  );
}

Modal and Drawer close guard

New useModalCloseGuard and useDrawerCloseGuard hooks are called inside modal content to keep the modal opened while a form is submitting or to ask before discarding changes:

import { useRef } from 'react';
import { Button, Group, Textarea, TextInput, useModal, useModalCloseGuard } from '@mantine/core';
import { useForm } from '@mantine/form';

function NoteForm({ onSave }: { onSave: () => void }) {
  const form = useForm({ initialValues: { title: '', text: '' } });
  const resolveRef = useRef<((discard: boolean) => void) | null>(null);

  const settle = (discard: boolean) => {
    resolveRef.current?.(discard);
    resolveRef.current = null;
  };

  const confirm = useModal({
    title: 'Discard changes?',
    size: 'sm',
    onClose: () => settle(false),
    children: (
      <Group justify="flex-end">
        <Button variant="default" onClick={() => confirm.close()}>
          Keep editing
        </Button>
        <Button
          color="red"
          onClick={() => {
            settle(true);
            confirm.close();
          }}
        >
          Discard
        </Button>
      </Group>
    ),
  });

  // Called before the modal is closed with the close button, Escape or overlay click
  const closeModal = useModalCloseGuard(
    () =>
      !form.isDirty() ||
      new Promise<boolean>((resolve) => {
        resolveRef.current = resolve;
        confirm.open();
      })
  );

  return (
    <form onSubmit={form.onSubmit(onSave)}>
      <TextInput label="Title" placeholder="Title" data-autofocus {...form.getInputProps('title')} />
      <Textarea label="Text" placeholder="Text" mt="md" {...form.getInputProps('text')} />
      <Group justify="flex-end" mt="md">
        <Button variant="default" onClick={closeModal}>
          Cancel
        </Button>
        <Button type="submit">Save</Button>
      </Group>
    </form>
  );
}

function Demo() {
  const modal = useModal({
    title: 'Edit note',
    children: <NoteForm onSave={() => modal.close()} />,
  });

  return <Button onClick={() => modal.open()}>Edit note</Button>;
}

Drawer swipe to dismiss

Drawer can now be closed with a swipe. It is enabled by default, set withSwipe={false} to disable it:

import { useDisclosure } from '@mantine/hooks';
import { Drawer, Button, Text } from '@mantine/core';

function Demo() {
  const [opened, { open, close }] = useDisclosure(false);

  return (
    <>
      <Drawer
        opened={opened}
        onClose={close}
        position="bottom"
        title="Swipe to dismiss"
        withCloseButton={false}
        withHandle
      >
        <Text>Drag the handle or swipe the drawer down to close it.</Text>
      </Drawer>

      <Button variant="default" onClick={open}>
        Open Drawer
      </Button>
    </>
  );
}

Drawer snap points

New snapPoints prop lets the Drawer stop at several sizes:

import { useDisclosure } from '@mantine/hooks';
import { Drawer, Button, Text } from '@mantine/core';

function Demo() {
  const [opened, { open, close }] = useDisclosure(false);

  return (
    <>
      <Drawer
        opened={opened}
        onClose={close}
        position="bottom"
        title="Snap points"
        snapPoints={[0.4, 0.75, 1]}
        defaultActiveSnapPoint={0.4}
        withCloseButton={false}
        withHandle
        dragHandlePosition="inside"
      >
        <Text>Drag the drawer up and down to snap it to 40%, 75% or 100% of the screen height.</Text>
      </Drawer>

      <Button variant="default" onClick={open}>
        Open Drawer
      </Button>
    </>
  );
}

Menu filled variant and item description

New variant="filled" of Menu highlights the hovered item with the primary color:

import { Menu, Button, Text } from '@mantine/core';
import { GearSixIcon, MagnifyingGlassIcon, ImageIcon, ChatCircleIcon, TrashIcon, ArrowsLeftRightIcon } from '@phosphor-icons/react';

function Demo() {
  return (
    <Menu variant="filled" shadow="md" width={200}>
      <Menu.Target>
        <Button variant="default">Toggle menu</Button>
      </Menu.Target>

      <Menu.Dropdown>
        <Menu.Label>Application</Menu.Label>
        <Menu.Item leftSection={<GearSixIcon size={14} />}>
          Settings
        </Menu.Item>
        <Menu.Item leftSection={<ChatCircleIcon size={14} />}>
          Messages
        </Menu.Item>
        <Menu.Item leftSection={<ImageIcon size={14} />}>
          Gallery
        </Menu.Item>
        <Menu.Item
          leftSection={<MagnifyingGlassIcon size={14} />}
          rightSection={
            <Text size="xs" opacity={0.6}>
              ⌘K
            </Text>
          }
        >
          Search
        </Menu.Item>

        <Menu.Divider />

        <Menu.Label>Danger zone</Menu.Label>
        <Menu.Item
          leftSection={<ArrowsLeftRightIcon size={14} />}
        >
          Transfer my data
        </Menu.Item>
        <Menu.Item
          color="red"
          leftSection={<TrashIcon size={14} />}
        >
          Delete my account
        </Menu.Item>
      </Menu.Dropdown>
    </Menu>
  );
}

New description prop of Menu.Item displays a second line of text below the label:

import { BellIcon, LinkIcon, TrashIcon, UserPlusIcon } from '@phosphor-icons/react';
import { Button, Menu } from '@mantine/core';

function Demo() {
  return (
    <Menu shadow="md" width={260}>
      <Menu.Target>
        <Button variant="default">Share</Button>
      </Menu.Target>

      <Menu.Dropdown>
        <Menu.Label>Share</Menu.Label>
        <Menu.Item
          leftSection={<LinkIcon size={14} />}
          description="Anyone with the link can view"
        >
          Copy link
        </Menu.Item>
        <Menu.Item
          leftSection={<UserPlusIcon size={14} />}
          description="Send an email invitation"
        >
          Invite people
        </Menu.Item>
        <Menu.Item
          leftSection={<BellIcon size={14} />}
          description="Digest, mentions or everything"
        >
          Notifications
        </Menu.Item>

        <Menu.Divider />

        <Menu.Item
          color="red"
          leftSection={<TrashIcon size={14} />}
          description="Moves the file to trash"
        >
          Delete file
        </Menu.Item>
      </Menu.Dropdown>
    </Menu>
  );
}

Menu async data

New Menu.Empty component displays a message when the menu has no items, for example while items are loading or when search returns nothing:

import { useState } from 'react';
import { Button, Group, Loader, Menu } from '@mantine/core';

function getRecentFiles() {
  return new Promise<string[]>((resolve) => {
    setTimeout(
      () => resolve(['Quarterly report.pdf', 'Roadmap 2027.key', 'Invoices.xlsx', 'Logo.svg']),
      1500
    );
  });
}

function Demo() {
  const [files, setFiles] = useState<string[] | null>(null);
  const [loading, setLoading] = useState(false);

  const handleOpen = () => {
    setLoading(true);
    getRecentFiles().then((result) => {
      setFiles(result);
      setLoading(false);
    });
  };

  return (
    <Menu width={240} onOpen={handleOpen}>
      <Menu.Target>
        <Button variant="default">Recent files</Button>
      </Menu.Target>

      <Menu.Dropdown>
        {loading && (
          <Menu.Empty>
            <Group gap="xs" justify="center">
              <Loader size={14} />
              Loading recent files
            </Group>
          </Menu.Empty>
        )}

        {!loading && files?.length === 0 && <Menu.Empty>No recent files</Menu.Empty>}

        {!loading && files?.map((file) => <Menu.Item key={file}>{file}</Menu.Item>)}
      </Menu.Dropdown>
    </Menu>
  );
}

New Menu.LoadMore component loads the next page of items when it is scrolled into view, focused or clicked:

import { useState } from 'react';
import { Button, Menu } from '@mantine/core';

const PAGE_SIZE = 8;
const TOTAL = 40;

function getUsers(page: number) {
  return new Promise<string[]>((resolve) => {
    setTimeout(() => {
      resolve(
        Array.from({ length: PAGE_SIZE }, (_, index) => `User ${page * PAGE_SIZE + index + 1}`)
      );
    }, 800);
  });
}

function Demo() {
  const [users, setUsers] = useState<string[]>([]);
  const [loading, setLoading] = useState(false);

  const loadMore = () => {
    setLoading(true);
    getUsers(users.length / PAGE_SIZE).then((page) => {
      setUsers((current) => [...current, ...page]);
      setLoading(false);
    });
  };

  return (
    <Menu width={220}>
      <Menu.Target>
        <Button variant="default">Assign to user</Button>
      </Menu.Target>

      <Menu.Dropdown>
        <Menu.ScrollArea mah={260}>
          {users.map((user) => (
            <Menu.Item key={user}>{user}</Menu.Item>
          ))}

          {users.length < TOTAL && (
            <Menu.LoadMore onLoadMore={loadMore} loading={loading}>
              {loading ? 'Loading users' : 'Load more users'}
            </Menu.LoadMore>
          )}
        </Menu.ScrollArea>
      </Menu.Dropdown>
    </Menu>
  );
}

Collapsible breadcrumbs

Breadcrumbs can now move links into a menu when the trail no longer fits on one line:

import { Anchor, Box, Breadcrumbs } from '@mantine/core';

function Demo() {
  return (
    <Box w={340} maw="100%" py={4} style={{ resize: 'horizontal', overflow: 'auto' }}>
      <Breadcrumbs collapse>
        <Anchor href="/">Mantine</Anchor>
        <Anchor href="/core/package/">Components</Anchor>
        <Anchor href="/core/breadcrumbs/">Breadcrumbs</Anchor>
        <span aria-current="page">Collapsing items</span>
      </Breadcrumbs>
    </Box>
  );
}

NavLink redesign

NavLink has a new look and a rail variant that marks the active link with a bar. Set withGuideline to display a guideline next to nested links:

import { FolderIcon, GaugeIcon, GearIcon, UsersIcon } from '@phosphor-icons/react';
import { Box, NavLink } from '@mantine/core';

function Demo() {
  return (
    <Box w={240}>
      <NavLink
        href="#required-for-focus"
        label="Dashboard"
        leftSection={<GaugeIcon size={16} />}
        variant="rail"
      />
      <NavLink
        label="Projects"
        leftSection={<FolderIcon size={16} />}
        variant="rail"
        withGuideline
        defaultOpened
      >
        <NavLink href="#required-for-focus" label="Website" variant="rail" active />
        <NavLink href="#required-for-focus" label="Mobile app" variant="rail" />
        <NavLink href="#required-for-focus" label="Design system" variant="rail" />
      </NavLink>
      <NavLink
        href="#required-for-focus"
        label="Team"
        leftSection={<UsersIcon size={16} />}
        variant="rail"
      />
      <NavLink
        href="#required-for-focus"
        label="Settings"
        leftSection={<GearIcon size={16} />}
        variant="rail"
      />
    </Box>
  );
}

New size prop controls font size and spacing:

Size
import { FolderIcon, GaugeIcon, UsersIcon } from '@phosphor-icons/react';
import { Box, NavLink } from '@mantine/core';

function Demo() {
  return (
    <Box w={260}>
      <NavLink
        href="#required-for-focus"
        label="Dashboard"
        leftSection={<GaugeIcon size={16} />}
      />
      <NavLink
        label="Projects"
        leftSection={<FolderIcon size={16} />}
        defaultOpened
      >
        <NavLink href="#required-for-focus" label="Website" active />
        <NavLink href="#required-for-focus" label="Mobile app" />
      </NavLink>
      <NavLink
        href="#required-for-focus"
        label="Team"
        description="12 members"
        leftSection={<UsersIcon size={16} />}
      />
    </Box>
  );
}

TableOfContents rail variant

TableOfContents has a new default rail variant and a smaller default size:

Variant
Color
Size
Radius
import { TableOfContents } from '@mantine/core';

function Demo() {
  return (
    <TableOfContents
      color="blue"
      scrollSpyOptions={{
        selector: '#mdx :is(h1, h2, h3, h4, h5, h6)',
      }}
    />
  );
}

Tree keyboard drag and drop

Tree nodes can now be moved with the keyboard when onDragDrop is set. Ctrl + arrow key (Cmd + arrow key on macOS) picks up the focused node, arrow keys move it, Enter drops it and Escape cancels the move. Screen readers announce every step, use the new labels prop to translate the announcements:

  • package.json
  • tsconfig.json
import { useState } from 'react';
import { FileTextIcon, FolderOpenIcon, FolderSimpleIcon } from '@phosphor-icons/react';
import { Group, moveTreeNode, RenderTreeNodePayload, Tree, TreeNodeData } from '@mantine/core';

const data: TreeNodeData[] = [
  {
    label: 'Pages',
    value: 'pages',
    children: [
      { label: 'index.tsx', value: 'pages/index.tsx' },
      { label: 'about.tsx', value: 'pages/about.tsx' },
      { label: 'contact.tsx', value: 'pages/contact.tsx' },
    ],
  },
  {
    label: 'Components',
    value: 'components',
    children: [
      { label: 'Header.tsx', value: 'components/Header.tsx' },
      { label: 'Footer.tsx', value: 'components/Footer.tsx' },
      { label: 'Sidebar.tsx', value: 'components/Sidebar.tsx' },
    ],
  },
  { label: 'package.json', value: 'package.json' },
  { label: 'tsconfig.json', value: 'tsconfig.json' },
];

function Leaf({ node, expanded, hasChildren, elementProps }: RenderTreeNodePayload) {
  return (
    <Group gap={6} {...elementProps}>
      {hasChildren ? (
        expanded ? (
          <FolderOpenIcon size={14} style={{ opacity: 0.75 }} />
        ) : (
          <FolderSimpleIcon size={14} style={{ opacity: 0.75 }} />
        )
      ) : (
        <FileTextIcon size={14} style={{ opacity: 0.75 }} />
      )}
      <span>{node.label}</span>
    </Group>
  );
}

function Demo() {
  const [treeData, setTreeData] = useState(data);

  return (
    <Tree
      data={treeData}
      withLines
      onDragDrop={(payload) =>
        setTreeData((current) => moveTreeNode(current, payload))
      }
      renderNode={(payload) => <Leaf {...payload} />}
    />
  );
}

Tabs variants

Tabs now support four new variants: inset, pill-compact, contained and enclosed:

import { Stack, Tabs, TabsVariant } from '@mantine/core';
import { ImageIcon, ChatCircleIcon, GearSixIcon } from '@phosphor-icons/react';

const variants: TabsVariant[] = ['inset', 'pill-compact', 'contained', 'enclosed'];

function Demo() {
  return (
    <Stack gap="xl">
      {variants.map((variant) => {
        const pt = variant === 'enclosed' ? undefined : 'xs';

        return (
          <Tabs key={variant} variant={variant} defaultValue="gallery">
            <Tabs.List>
              <Tabs.Tab value="gallery" leftSection={<ImageIcon size={12} />}>
                Gallery
              </Tabs.Tab>
              <Tabs.Tab value="messages" leftSection={<ChatCircleIcon size={12} />}>
                Messages
              </Tabs.Tab>
              <Tabs.Tab value="settings" leftSection={<GearSixIcon size={12} />}>
                Settings
              </Tabs.Tab>
            </Tabs.List>

            <Tabs.Panel value="gallery" pt={pt}>
              Gallery tab content
            </Tabs.Panel>
            <Tabs.Panel value="messages" pt={pt}>
              Messages tab content
            </Tabs.Panel>
            <Tabs.Panel value="settings" pt={pt}>
              Settings tab content
            </Tabs.Panel>
          </Tabs>
        );
      })}
    </Stack>
  );
}

Stepper redesign

Stepper has a new look:

Step 2 content: Verify email
import { useState } from 'react';
import { Stepper, Button, Group } from '@mantine/core';

function Demo() {
  const [active, setActive] = useState(1);
  const nextStep = () => setActive((current) => (current < 3 ? current + 1 : current));
  const prevStep = () => setActive((current) => (current > 0 ? current - 1 : current));

  return (
    <>
      <Stepper active={active} onStepClick={setActive}>
        <Stepper.Step label="First step" description="Create an account">
          Step 1 content: Create an account
        </Stepper.Step>
        <Stepper.Step label="Second step" description="Verify email">
          Step 2 content: Verify email
        </Stepper.Step>
        <Stepper.Step label="Final step" description="Get full access">
          Step 3 content: Get full access
        </Stepper.Step>
        <Stepper.Completed>
          Completed, click back button to get to previous step
        </Stepper.Completed>
      </Stepper>

      <Group justify="center" mt="xl">
        <Button variant="default" onClick={prevStep}>Back</Button>
        <Button onClick={nextStep}>Next step</Button>
      </Group>
    </>
  );
}

Slider thumb redesign

Slider and RangeSlider have a new thumb:

Color
Size
import { RangeSlider, Slider, Stack } from '@mantine/core';

function Demo() {
  return (
    <Stack gap="xl">
      <Slider defaultValue={40} color="blue" />
      <RangeSlider defaultValue={[20, 60]} color="blue" />
    </Stack>
  );
}

Blockquote redesign

Blockquote has a new look:

Life is like an npm install – you never know what you are going to get.– Forrest Gump
Color
Icon size
import { Blockquote } from '@mantine/core';
import { InfoIcon } from '@phosphor-icons/react';

function Demo() {
  const icon = <InfoIcon />;
  return (
    <Blockquote color="blue" cite="– Forrest Gump" icon={icon}>
      Life is like an npm install – you never know what you are going to get.
    </Blockquote>
  );
}

Alert redesign

Alert has a new look:

import { CheckCircleIcon, InfoIcon, WarningIcon, XCircleIcon } from '@phosphor-icons/react';
import { Alert, Stack } from '@mantine/core';

function Demo() {
  return (
    <Stack>
      <Alert
        color="blue"
        icon={<InfoIcon />}
        title="Payment method expires soon"
        withCloseButton
        closeButtonLabel="Dismiss"
      >
        The card ending in 4242 expires on 30 September. Update it to keep your subscription
        active.
      </Alert>

      <Alert color="teal" icon={<CheckCircleIcon />} title="Changes saved">
        Your notification preferences were updated.
      </Alert>

      <Alert color="yellow" icon={<WarningIcon />} title="Storage almost full">
        You have used 92% of your 50 GB plan. Delete files or upgrade to keep uploading.
      </Alert>

      <Alert color="red" icon={<XCircleIcon />} title="Build failed">
        Two required environment variables are missing: DATABASE_URL and SESSION_SECRET.
      </Alert>
    </Stack>
  );
}

Notification redesign

Notification has a new look:

import { CheckIcon } from '@phosphor-icons/react';
import { Notification, Stack } from '@mantine/core';

function Demo() {
  const icon = <CheckIcon />;

  return (
    <Stack>
      <Notification variant="filled" icon={icon} color="teal" title="Changes saved">
        Your profile was updated
      </Notification>
      <Notification variant="light" icon={icon} color="teal" title="Changes saved">
        Your profile was updated
      </Notification>
      <Notification variant="transparent" icon={icon} color="teal" title="Changes saved">
        Your profile was updated
      </Notification>
    </Stack>
  );
}

Compact notifications

The Notifications component now supports a compact snackbar presentation for brief confirmations:

import { CheckIcon, XIcon } from '@phosphor-icons/react';
import { Button, Group, ThemeIcon } from '@mantine/core';
import { createNotificationsStore, Notifications, notifications } from '@mantine/notifications';

const store = createNotificationsStore();

function Demo() {
  return (
    <>
      <Notifications store={store} presentation="snackbar" />
      <Group justify="center">
        <Button onClick={() => notifications.show({ message: 'Note added', icon: '✓' }, store)}>
          Add note
        </Button>
        <Button
          color="red"
          onClick={() =>
            notifications.show(
              {
                message: 'Could not save note',
                icon: (
                  <ThemeIcon color="red" radius="xl" size="sm">
                    <XIcon size={14} />
                  </ThemeIcon>
                ),
              },
              store
            )
          }
        >
          Danger
        </Button>
        <Button
          color="teal"
          onClick={() =>
            notifications.show(
              {
                message: 'Note saved',
                icon: (
                  <ThemeIcon color="teal" radius="xl" size="sm">
                    <CheckIcon size={14} />
                  </ThemeIcon>
                ),
              },
              store
            )
          }
        >
          Success
        </Button>
      </Group>
    </>
  );
}

use-hold-repeat and use-hold-repeat-handlers hooks

use-hold-repeat repeats an action while a control is held, with an optional accelerating interval. Use use-hold-repeat-handlers to attach pointer and keyboard handlers to the control:

0

import { useState } from 'react';
import { MinusIcon, PlusIcon } from '@phosphor-icons/react';
import { ActionIcon, Group, Text } from '@mantine/core';
import { useHoldRepeatHandlers } from '@mantine/hooks';

const interval = (step: number) => Math.max(40, 300 - step * 20);

function Demo() {
  const [count, setCount] = useState(0);

  const increment = useHoldRepeatHandlers(() => setCount((c) => c + 1), { delay: 400, interval });
  const decrement = useHoldRepeatHandlers(() => setCount((c) => c - 1), { delay: 400, interval });

  return (
    <Group>
      <ActionIcon {...decrement} variant="default" size="lg" aria-label="Decrement">
        <MinusIcon size={18} />
      </ActionIcon>
      <Text fw={500} w={60} ta="center">{count}</Text>
      <ActionIcon {...increment} variant="default" size="lg" aria-label="Increment">
        <PlusIcon size={18} />
      </ActionIcon>
    </Group>
  );
}

use-debounced-effect and use-throttled-effect hooks

use-debounced-effect runs an effect after its dependencies stop changing. Use use-throttled-effect to run it at most once per interval while they change:

Effect runs: 0

Last searched: –

import { useState } from 'react';
import { Badge, Group, Stack, Text, TextInput } from '@mantine/core';
import { useDebouncedEffect } from '@mantine/hooks';

function Demo() {
  const [query, setQuery] = useState('');
  const [runs, setRuns] = useState(0);
  const [lastQuery, setLastQuery] = useState('');

  useDebouncedEffect(
    () => {
      setRuns((current) => current + 1);
      setLastQuery(query);
    },
    [query],
    500
  );

  return (
    <Stack>
      <TextInput
        label="Type quickly – the effect runs 500ms after you stop"
        placeholder="Search..."
        value={query}
        onChange={(event) => setQuery(event.currentTarget.value)}
      />
      <Group>
        <Badge>Effect runs: {runs}</Badge>
        <Text size="sm">Last searched: {lastQuery || '–'}</Text>
      </Group>
    </Stack>
  );
}

use-clipboard blobs and images support

use-clipboard can now copy images and other binary data from a Blob, ClipboardItem or ClipboardItem[]. Check supported before offering to copy an image:

import { useEffect, useRef } from 'react';
import { useClipboard } from '@mantine/hooks';
import { Button, Stack } from '@mantine/core';

function Demo() {
  const clipboard = useClipboard();
  const canvasRef = useRef<HTMLCanvasElement>(null);

  useEffect(() => {
    const ctx = canvasRef.current?.getContext('2d');
    if (!ctx) {
      return;
    }

    const gradient = ctx.createLinearGradient(0, 0, 240, 120);
    gradient.addColorStop(0, '#4c6ef5');
    gradient.addColorStop(1, '#e64980');
    ctx.fillStyle = gradient;
    ctx.fillRect(0, 0, 240, 120);
    ctx.fillStyle = 'white';
    ctx.font = 'bold 22px sans-serif';
    ctx.fillText('Mantine', 20, 68);
  }, []);

  const copyImage = () => {
    const canvas = canvasRef.current;
    if (!canvas) {
      return;
    }

    // Construct the ClipboardItem with a Promise synchronously so that the write
    // stays within the user gesture (required by Safari)
    const blob = new Promise<Blob>((resolve, reject) => {
      canvas.toBlob(
        (result) => (result ? resolve(result) : reject(new Error('Failed to export image'))),
        'image/png'
      );
    });

    clipboard.copy(new ClipboardItem({ 'image/png': blob }));
  };

  return (
    <Stack align="center">
      <canvas ref={canvasRef} width={240} height={120} style={{ borderRadius: 8 }} />
      <Button
        color={clipboard.copied ? 'teal' : undefined}
        disabled={!clipboard.supported}
        onClick={copyImage}
      >
        {clipboard.copied ? 'Image copied' : 'Copy image'}
      </Button>
    </Stack>
  );
}

use-broadcast-channel hook

New use-broadcast-channel sends and receives messages across tabs, windows, frames and workers on the same origin. Open the demo in two tabs to try it:

Tab A

unsupported

Last received

—

Tab B

unsupported

Last received

—

import { useBroadcastChannel } from '@mantine/hooks';
import { Badge, Button, Group, Paper, Text } from '@mantine/core';

const reactions = ['👋', '🎉', '☕', '🚀'];

function Panel({ label }: { label: string }) {
  const { supported, data, post } = useBroadcastChannel<string>('mantine-demo-channel');

  return (
    <Paper withBorder p="md" flex={1}>
      <Group justify="space-between" mb="md">
        <Text fw={500}>{label}</Text>
        <Badge color={supported ? 'teal' : 'red'} variant="light">
          {supported ? 'supported' : 'unsupported'}
        </Badge>
      </Group>

      <Text size="sm" c="dimmed">Last received</Text>
      <Text fz={32}>{data ?? '—'}</Text>

      <Group mt="md" gap="xs">
        {reactions.map((reaction) => (
          <Button key={reaction} variant="default" onClick={() => post(reaction)}>
            {reaction}
          </Button>
        ))}
      </Group>
    </Paper>
  );
}

// Both panels create their own channel with the same name, so a message posted
// from one is delivered to the other (but never back to the sender). Open this
// page in a second browser tab to see the reactions sync across tabs as well.
function Demo() {
  return (
    <Group align="stretch" grow>
      <Panel label="Tab A" />
      <Panel label="Tab B" />
    </Group>
  );
}

Other changes

Appearance and theming

  • Chip, Switch and Slider now follow theme.autoContrast: chip text, switch thumb and inner labels, filled slider thumb icons adjust to the control color.
  • Slider and RangeSlider marks on the filled part of the track follow autoContrast.
  • Selected options in Combobox dropdowns and active TimePicker controls use the primary color contrast color.
  • ColorPicker now follows theme.defaultRadius.
  • JsonViewer now uses the same syntax colors as CodeHighlight in both light and dark color schemes.
  • Alert now supports size and closeButtonProps props.
  • Avatar.Group now supports max prop: avatars that do not fit are replaced with a +N counter.
  • Badge with variant="dot" no longer renders leftSection.
  • RingProgress now supports segments prop to divide the ring into equal parts.
  • The Switch thumb now stretches while pressed.
  • Kbd now looks like a raised keycap in both light and dark color schemes.

Inputs and dates

  • Input rendered inside another input's section (for example, NativeSelect in the rightSection of NumberInput) no longer inherits the outer input's section width, error color and size styles.
  • Input.Wrapper now supports withBlockChildren prop to render non-input children with the same spacing as inputs.
  • Textarea bottomSection no longer blocks clicks: a click on it focuses the textarea. Set bottomSectionPointerEvents="all" for interactive content.
  • AngleSlider now supports largeStep and readOnly props and PageUp/PageDown keys.
  • JsonInput now disables browser spellcheck, autocorrect and grammar extensions (Grammarly, LanguageTool) on its textarea.
  • NumberInput now supports controlsPosition="sides" to display the decrement button on the left and the increment button on the right.
  • PasswordInput visibility toggle icon is now smaller.
  • PhoneInput without defaultCountry now displays a globe icon in the country button until a country is selected.
  • Pills in PillsInput, MultiSelect, TagsInput and TreeSelect are larger and fill the input.
  • MultiSelect and TagsInput now support maxDisplayedValues prop, and wrapPills={false} keeps their pills on one line.
  • Select and other Combobox-based components now support scrollBehavior="smooth" for keyboard navigation.
  • DatePickerInput and the other picker inputs (month, year, week, quarter) with type="multiple" now support valueDisplay="pills" to render a removable pill per selected value.
  • DatesProvider consistentWeeks is now true by default – every month has 6 weeks, set consistentWeeks: false to restore the previous behavior.

Overlays and dropdowns

  • Drawer now supports fullScreen. Use fullScreenBelow on Modal or Drawer to go full screen below a breakpoint.
  • Drawer now fits its content with size="auto". Set withHandle to show a drag handle.
  • Dropdowns nested inside a Popover can now keep their portals enabled without closing the outer popover.
  • Popover.ScrollArea, Menu.ScrollArea and Combobox.ScrollArea make long dropdown content scrollable.
  • Tooltip now opens on keyboard focus, set events={{ hover: true, focus: false, touch: false }} to restore the previous behavior.
  • Set events={{ click: true }} on Tooltip to toggle it on click.
  • Spotlight now supports virtualized actions lists: set totalActionsCount on Spotlight.ActionsList and selected on rendered Spotlight.Action components.

Navigation and layout

  • Breadcrumbs and Pagination root elements are now nav landmarks.
  • NavLink with nested links and without href is now rendered as a button element.
  • Stepper.Step and Timeline.Item can now be wrapped in other components.
  • Timeline.Item now supports active and lineActive props.
  • Tree now receives its store with the store prop, see the migration guide.
  • The Tree store now has scrollTo to expand a node's ancestors and scroll it into view. Use getNodePath to get its path.
  • Affix now supports withSafeArea prop to keep the content clear of the device notch.
  • Set withControls={false} on Scroller to hide its navigation buttons.

Accessibility

  • Combobox.Target now sets role="combobox" and aria-expanded, set withExpandedAttribute={false} to restore the previous behavior.
  • LoadingOverlay now announces the loading state to screen readers, change the text with loadingLabel prop.
  • Pill remove button now has aria-label="Remove" by default.

Hooks

  • use-click-outside now detects clicks inside iframes, so Popover, Menu and Combobox dropdowns close when the user clicks an iframe.
  • useMatches now accepts custom breakpoints.
  • use-uncontrolled now returns the same setter across renders in both modes. It always calls the latest onChange.
  • writeLocalStorageValue and removeLocalStorageValue update useLocalStorage subscribers without rerendering the caller.

Examples

  • New Combobox examples: select all in multiselect, category filter in the dropdown header, option details panel and mobile bottom sheet.
  • New form examples show complete forms built with useForm.