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.

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.

NameTypeDefaultDescription
childrennode-

The content of the component.

classesobject-

Override or extend the styles applied to the component.

See CSS classes API below for more details.

disabledboolfalse

If true, the component is disabled.

loadingboolfalse

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

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

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.

loadingPosition'start'
| 'end'
| 'center'
'center'

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

sxArray<func
| object
| bool>
| func
| object
-

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

See the `sx` page for more details.

variant'contained'
| 'outlined'
| 'text'
| string
'text'

The variant to use.

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.

Class nameRule nameDescription
.Mui-disabledState class applied to the root element if disabled={true}.
.Mui-focusVisibleState class applied to the ButtonBase root element if the button is keyboard focused.
.MuiLoadingButton-colorErrorcolorErrorStyles applied to the root element if color="error".
.MuiLoadingButton-colorInfocolorInfoStyles applied to the root element if color="info".
.MuiLoadingButton-colorInheritcolorInheritStyles applied to the root element if color="inherit".
.MuiLoadingButton-colorPrimarycolorPrimaryStyles applied to the root element if color="primary".
.MuiLoadingButton-colorSecondarycolorSecondaryStyles applied to the root element if color="secondary".
.MuiLoadingButton-colorSuccesscolorSuccessStyles applied to the root element if color="success".
.MuiLoadingButton-colorWarningcolorWarningStyles applied to the root element if color="warning".
.MuiLoadingButton-containedcontainedStyles applied to the root element if variant="contained".
.MuiLoadingButton-containedErrorcontainedErrorStyles applied to the root element if variant="contained" and color="error".
.MuiLoadingButton-containedInfocontainedInfoStyles applied to the root element if variant="contained" and color="info".
.MuiLoadingButton-containedInheritcontainedInheritStyles applied to the root element if variant="contained" and color="inherit".
.MuiLoadingButton-containedPrimarycontainedPrimaryStyles applied to the root element if variant="contained" and color="primary".
.MuiLoadingButton-containedSecondarycontainedSecondaryStyles applied to the root element if variant="contained" and color="secondary".
.MuiLoadingButton-containedSizeLargecontainedSizeLargeStyles applied to the root element if size="large" and variant="contained".
.MuiLoadingButton-containedSizeMediumcontainedSizeMediumStyles applied to the root element if size="medium" and variant="contained".
.MuiLoadingButton-containedSizeSmallcontainedSizeSmallStyles applied to the root element if size="small" and variant="contained".
.MuiLoadingButton-containedSuccesscontainedSuccessStyles applied to the root element if variant="contained" and color="success".
.MuiLoadingButton-containedWarningcontainedWarningStyles applied to the root element if variant="contained" and color="warning".
.MuiLoadingButton-disableElevationdisableElevationStyles applied to the root element if disableElevation={true}.
.MuiLoadingButton-endIconendIconStyles applied to the endIcon element if supplied.
.MuiLoadingButton-endIconLoadingEndendIconLoadingEndStyles applied to the endIcon element if loading={true} and loadingPosition="end".
.MuiLoadingButton-fullWidthfullWidthStyles applied to the root element if fullWidth={true}.
.MuiLoadingButton-iconiconStyles applied to the icon element if supplied
.MuiLoadingButton-iconSizeLargeiconSizeLargeStyles applied to the icon element if supplied and size="large".
.MuiLoadingButton-iconSizeMediumiconSizeMediumStyles applied to the icon element if supplied and size="medium".
.MuiLoadingButton-iconSizeSmalliconSizeSmallStyles applied to the icon element if supplied and size="small".
.MuiLoadingButton-loadingloadingStyles applied to the root element if loading={true}.
.MuiLoadingButton-loadingIndicatorloadingIndicatorStyles applied to the loadingIndicator element.
.MuiLoadingButton-loadingIndicatorCenterloadingIndicatorCenterStyles applied to the loadingIndicator element if loadingPosition="center".
.MuiLoadingButton-loadingIndicatorEndloadingIndicatorEndStyles applied to the loadingIndicator element if loadingPosition="end".
.MuiLoadingButton-loadingIndicatorStartloadingIndicatorStartStyles applied to the loadingIndicator element if loadingPosition="start".
.MuiLoadingButton-outlinedoutlinedStyles applied to the root element if variant="outlined".
.MuiLoadingButton-outlinedErroroutlinedErrorStyles applied to the root element if variant="outlined" and color="error".
.MuiLoadingButton-outlinedInfooutlinedInfoStyles applied to the root element if variant="outlined" and color="info".
.MuiLoadingButton-outlinedInheritoutlinedInheritStyles applied to the root element if variant="outlined" and color="inherit".
.MuiLoadingButton-outlinedPrimaryoutlinedPrimaryStyles applied to the root element if variant="outlined" and color="primary".
.MuiLoadingButton-outlinedSecondaryoutlinedSecondaryStyles applied to the root element if variant="outlined" and color="secondary".
.MuiLoadingButton-outlinedSizeLargeoutlinedSizeLargeStyles applied to the root element if size="large" and variant="outlined".
.MuiLoadingButton-outlinedSizeMediumoutlinedSizeMediumStyles applied to the root element if size="medium" and variant="outlined".
.MuiLoadingButton-outlinedSizeSmalloutlinedSizeSmallStyles applied to the root element if size="small" and variant="outlined".
.MuiLoadingButton-outlinedSuccessoutlinedSuccessStyles applied to the root element if variant="outlined" and color="success".
.MuiLoadingButton-outlinedWarningoutlinedWarningStyles applied to the root element if variant="outlined" and color="warning".
.MuiLoadingButton-rootrootStyles applied to the root element.
.MuiLoadingButton-sizeLargesizeLargeStyles applied to the root element if size="large".
.MuiLoadingButton-sizeMediumsizeMediumStyles applied to the root element if size="medium".
.MuiLoadingButton-sizeSmallsizeSmallStyles applied to the root element if size="small".
.MuiLoadingButton-startIconstartIconStyles applied to the startIcon element if supplied.
.MuiLoadingButton-startIconLoadingStartstartIconLoadingStartStyles applied to the startIcon element if loading={true} and loadingPosition="start".
.MuiLoadingButton-texttextStyles applied to the root element if variant="text".
.MuiLoadingButton-textErrortextErrorStyles applied to the root element if variant="text" and color="error".
.MuiLoadingButton-textInfotextInfoStyles applied to the root element if variant="text" and color="info".
.MuiLoadingButton-textInherittextInheritStyles applied to the root element if variant="text" and color="inherit".
.MuiLoadingButton-textPrimarytextPrimaryStyles applied to the root element if variant="text" and color="primary".
.MuiLoadingButton-textSecondarytextSecondaryStyles applied to the root element if variant="text" and color="secondary".
.MuiLoadingButton-textSizeLargetextSizeLargeStyles applied to the root element if size="large" and variant="text".
.MuiLoadingButton-textSizeMediumtextSizeMediumStyles applied to the root element if size="medium" and variant="text".
.MuiLoadingButton-textSizeSmalltextSizeSmallStyles applied to the root element if size="small" and variant="text".
.MuiLoadingButton-textSuccesstextSuccessStyles applied to the root element if variant="text" and color="success".
.MuiLoadingButton-textWarningtextWarningStyles applied to the root element if variant="text" and color="warning".

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