Skip to content

LoadingButton API

API reference docs for the React LoadingButton component. Learn about the props, CSS, and other APIs of this exported module.

Component demos

Import

import LoadingButton from '@mui/lab/LoadingButton';
// or
import { LoadingButton } from '@mui/lab';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the Button component are also available.

children

The content of the component.

Type:node


classes

Override or extend the styles applied to the component.

See CSS API below for more details.

Type:object


disabled

If true, the component is disabled.

Type:bool

Default:false


loading

If true, the loading indicator is shown and the button becomes disabled.

Type:bool

Default:false


loadingIndicator

Element placed before the children if the button is in loading state. The node should contain an element with role="progressbar" with an accessible name. By default we render a CircularProgress that is labelled by the button itself.

Type:node

Default:<CircularProgress color="inherit" size={16} />


loadingPosition

The loading indicator can be positioned on the start, end, or the center of the button.

Type:'start'
| 'end'
| 'center'

Default:'center'


sx

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

Type:Array<func
| object
| bool>
| func
| object


variant

The variant to use.

Type:'contained'
| 'outlined'
| 'text'
| string

Default:'text'


The ref is forwarded to the root element.

Inheritance

While not explicitly documented above, the props of the Button component are also available in LoadingButton. You can take advantage of this to target nested components.


Theme default props

You can use MuiLoadingButton to change the default props of this component with the theme.


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.Mui-disabledSTATE

State class applied to the root element if disabled={true}.


.Mui-focusVisibleSTATE

State class applied to the ButtonBase root element if the button is keyboard focused.


.MuiLoadingButton-colorInherit

Styles applied to the root element if color="inherit".

Rule name:colorInherit


.MuiLoadingButton-contained

Styles applied to the root element if variant="contained".

Rule name:contained


.MuiLoadingButton-containedError

Styles applied to the root element if variant="contained" and color="error".

Rule name:containedError


.MuiLoadingButton-containedInfo

Styles applied to the root element if variant="contained" and color="info".

Rule name:containedInfo


.MuiLoadingButton-containedInherit

Styles applied to the root element if variant="contained" and color="inherit".

Rule name:containedInherit


.MuiLoadingButton-containedPrimary

Styles applied to the root element if variant="contained" and color="primary".

Rule name:containedPrimary


.MuiLoadingButton-containedSecondary

Styles applied to the root element if variant="contained" and color="secondary".

Rule name:containedSecondary


.MuiLoadingButton-containedSizeLarge

Styles applied to the root element if size="large" and variant="contained".

Rule name:containedSizeLarge


.MuiLoadingButton-containedSizeMedium

Styles applied to the root element if size="medium" and variant="contained".

Rule name:containedSizeMedium


.MuiLoadingButton-containedSizeSmall

Styles applied to the root element if size="small" and variant="contained".

Rule name:containedSizeSmall


.MuiLoadingButton-containedSuccess

Styles applied to the root element if variant="contained" and color="success".

Rule name:containedSuccess


.MuiLoadingButton-containedWarning

Styles applied to the root element if variant="contained" and color="warning".

Rule name:containedWarning


.MuiLoadingButton-disableElevation

Styles applied to the root element if disableElevation={true}.

Rule name:disableElevation


.MuiLoadingButton-endIcon

Styles applied to the endIcon element if supplied.

Rule name:endIcon


.MuiLoadingButton-endIconLoadingEnd

Styles applied to the endIcon element if loading={true} and loadingPosition="end".

Rule name:endIconLoadingEnd


.MuiLoadingButton-fullWidth

Styles applied to the root element if fullWidth={true}.

Rule name:fullWidth


.MuiLoadingButton-iconSizeLarge

Styles applied to the icon element if supplied and size="large".

Rule name:iconSizeLarge


.MuiLoadingButton-iconSizeMedium

Styles applied to the icon element if supplied and size="medium".

Rule name:iconSizeMedium


.MuiLoadingButton-iconSizeSmall

Styles applied to the icon element if supplied and size="small".

Rule name:iconSizeSmall


.MuiLoadingButton-loading

Styles applied to the root element if loading={true}.

Rule name:loading


.MuiLoadingButton-loadingIndicator

Styles applied to the loadingIndicator element.

Rule name:loadingIndicator


.MuiLoadingButton-loadingIndicatorCenter

Styles applied to the loadingIndicator element if loadingPosition="center".

Rule name:loadingIndicatorCenter


.MuiLoadingButton-loadingIndicatorEnd

Styles applied to the loadingIndicator element if loadingPosition="end".

Rule name:loadingIndicatorEnd


.MuiLoadingButton-loadingIndicatorStart

Styles applied to the loadingIndicator element if loadingPosition="start".

Rule name:loadingIndicatorStart


.MuiLoadingButton-outlined

Styles applied to the root element if variant="outlined".

Rule name:outlined


.MuiLoadingButton-outlinedError

Styles applied to the root element if variant="outlined" and color="error".

Rule name:outlinedError


.MuiLoadingButton-outlinedInfo

Styles applied to the root element if variant="outlined" and color="info".

Rule name:outlinedInfo


.MuiLoadingButton-outlinedInherit

Styles applied to the root element if variant="outlined" and color="inherit".

Rule name:outlinedInherit


.MuiLoadingButton-outlinedPrimary

Styles applied to the root element if variant="outlined" and color="primary".

Rule name:outlinedPrimary


.MuiLoadingButton-outlinedSecondary

Styles applied to the root element if variant="outlined" and color="secondary".

Rule name:outlinedSecondary


.MuiLoadingButton-outlinedSizeLarge

Styles applied to the root element if size="large" and variant="outlined".

Rule name:outlinedSizeLarge


.MuiLoadingButton-outlinedSizeMedium

Styles applied to the root element if size="medium" and variant="outlined".

Rule name:outlinedSizeMedium


.MuiLoadingButton-outlinedSizeSmall

Styles applied to the root element if size="small" and variant="outlined".

Rule name:outlinedSizeSmall


.MuiLoadingButton-outlinedSuccess

Styles applied to the root element if variant="outlined" and color="success".

Rule name:outlinedSuccess


.MuiLoadingButton-outlinedWarning

Styles applied to the root element if variant="outlined" and color="warning".

Rule name:outlinedWarning


.MuiLoadingButton-root

Styles applied to the root element.

Rule name:root


.MuiLoadingButton-sizeLarge

Styles applied to the root element if size="large".

Rule name:sizeLarge


.MuiLoadingButton-sizeMedium

Styles applied to the root element if size="medium".

Rule name:sizeMedium


.MuiLoadingButton-sizeSmall

Styles applied to the root element if size="small".

Rule name:sizeSmall


.MuiLoadingButton-startIcon

Styles applied to the startIcon element if supplied.

Rule name:startIcon


.MuiLoadingButton-startIconLoadingStart

Styles applied to the startIcon element if loading={true} and loadingPosition="start".

Rule name:startIconLoadingStart


.MuiLoadingButton-text

Styles applied to the root element if variant="text".

Rule name:text


.MuiLoadingButton-textError

Styles applied to the root element if variant="text" and color="error".

Rule name:textError


.MuiLoadingButton-textInfo

Styles applied to the root element if variant="text" and color="info".

Rule name:textInfo


.MuiLoadingButton-textInherit

Styles applied to the root element if variant="text" and color="inherit".

Rule name:textInherit


.MuiLoadingButton-textPrimary

Styles applied to the root element if variant="text" and color="primary".

Rule name:textPrimary


.MuiLoadingButton-textSecondary

Styles applied to the root element if variant="text" and color="secondary".

Rule name:textSecondary


.MuiLoadingButton-textSizeLarge

Styles applied to the root element if size="large" and variant="text".

Rule name:textSizeLarge


.MuiLoadingButton-textSizeMedium

Styles applied to the root element if size="medium" and variant="text".

Rule name:textSizeMedium


.MuiLoadingButton-textSizeSmall

Styles applied to the root element if size="small" and variant="text".

Rule name:textSizeSmall


.MuiLoadingButton-textSuccess

Styles applied to the root element if variant="text" and color="success".

Rule name:textSuccess


.MuiLoadingButton-textWarning

Styles applied to the root element if variant="text" and color="warning".

Rule name:textWarning



You can override the style of the component using one of these customization options: