Overlay over given container with centered Loader


Use LoadingOverlay to overlay element to disable interactions and indicate loading state. Note that elements under overlay are still focusable with keyboard. Remember to add additional logic to handle this case.

Overlay had absolute position and will take 100% of width and height of nearest parent container with relative position. Use it when you need to disable user interactions and indicate loading state, for example, while form is submitting.

visible is the only required prop, if it set to false component will not render anything.

import { useState } from 'react';
import { LoadingOverlay, Button, Group } from '@mantine/core';
function Demo() {
const [visible, setVisible] = useState(false);
// Note that position: relative is required
return (
<div style={{ width: 400, position: 'relative' }}>
<LoadingOverlay visible={visible} />
{/* ...other content */}
<Group position="center">
<Button onClick={() => setVisible((v) => !v)}>Toggle overlay</Button>

Transition duration

You can change appear and disappear animations duration by passing transitionDuration prop:

// 500ms animations
<LoadingOverlay transitionDuration={500} />
// disable animations
<LoadingOverlay transitionDuration={0} />

Loader and Overlay props

LoadingOverlay is built using Overlay and Loader components. You can change all props of Loader component, opacity and color of Overlay:

import { LoadingOverlay } from '@mantine/core';
function Demo() {
return (
loaderProps={{ size: 'sm', color: 'pink', variant: 'bars' }}

Configure default loader

You can configure default loader in MantineProvider, it will be used in Loader and LoadingOverlay components by default:

import { MantineProvider } from '@mantine/core';
function Demo() {
return (
<MantineProvider theme={{ loader: 'bars' }}>
<YourApp />

Custom loader

You can use any other loader with LoadingOverlay by setting loader prop:

import { DEFAULT_THEME, LoadingOverlay } from '@mantine/core';
const customLoader = (
viewBox="0 0 38 38"
<g fill="none" fillRule="evenodd">
<g transform="translate(1 1)" strokeWidth="2">
<circle strokeOpacity=".5" cx="18" cy="18" r="18" />
<path d="M36 18c0-9.94-8.06-18-18-18">
from="0 18 18"
to="360 18 18"
function Demo() {
return <LoadingOverlay loader={customLoader} visible />;