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';
Props of the Button component are also available.
Override or extend the styles applied to the component.
See CSS API below for more details.
Type:object
If true
, the loading indicator is shown and the button becomes disabled.
Type:bool
Default:false
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} />
The loading indicator can be positioned on the start, end, or the center of the button.
Type:'start'
| 'end'
| 'center'
Default:'center'
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
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.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
State class applied to the ButtonBase root element if the button is keyboard focused.
Styles applied to the root element if color="inherit"
.
Rule name:colorInherit
Styles applied to the root element if variant="contained"
.
Rule name:contained
Styles applied to the root element if variant="contained"
and color="error"
.
Rule name:containedError
Styles applied to the root element if variant="contained"
and color="info"
.
Rule name:containedInfo
Styles applied to the root element if variant="contained"
and color="inherit"
.
Rule name:containedInherit
Styles applied to the root element if variant="contained"
and color="primary"
.
Rule name:containedPrimary
Styles applied to the root element if variant="contained"
and color="secondary"
.
Rule name:containedSecondary
Styles applied to the root element if size="large"
and variant="contained"
.
Rule name:containedSizeLarge
Styles applied to the root element if size="medium"
and variant="contained"
.
Rule name:containedSizeMedium
Styles applied to the root element if size="small"
and variant="contained"
.
Rule name:containedSizeSmall
Styles applied to the root element if variant="contained"
and color="success"
.
Rule name:containedSuccess
Styles applied to the root element if variant="contained"
and color="warning"
.
Rule name:containedWarning
Styles applied to the root element if disableElevation={true}
.
Rule name:disableElevation
Styles applied to the endIcon element if loading={true}
and loadingPosition="end"
.
Rule name:endIconLoadingEnd
Styles applied to the root element if fullWidth={true}
.
Rule name:fullWidth
Styles applied to the icon element if supplied and size="large"
.
Rule name:iconSizeLarge
Styles applied to the icon element if supplied and size="medium"
.
Rule name:iconSizeMedium
Styles applied to the icon element if supplied and size="small"
.
Rule name:iconSizeSmall
Styles applied to the loadingIndicator element.
Rule name:loadingIndicator
Styles applied to the loadingIndicator element if loadingPosition="center"
.
Rule name:loadingIndicatorCenter
Styles applied to the loadingIndicator element if loadingPosition="end"
.
Rule name:loadingIndicatorEnd
Styles applied to the loadingIndicator element if loadingPosition="start"
.
Rule name:loadingIndicatorStart
Styles applied to the root element if variant="outlined"
.
Rule name:outlined
Styles applied to the root element if variant="outlined"
and color="error"
.
Rule name:outlinedError
Styles applied to the root element if variant="outlined"
and color="info"
.
Rule name:outlinedInfo
Styles applied to the root element if variant="outlined"
and color="inherit"
.
Rule name:outlinedInherit
Styles applied to the root element if variant="outlined"
and color="primary"
.
Rule name:outlinedPrimary
Styles applied to the root element if variant="outlined"
and color="secondary"
.
Rule name:outlinedSecondary
Styles applied to the root element if size="large"
and variant="outlined"
.
Rule name:outlinedSizeLarge
Styles applied to the root element if size="medium"
and variant="outlined"
.
Rule name:outlinedSizeMedium
Styles applied to the root element if size="small"
and variant="outlined"
.
Rule name:outlinedSizeSmall
Styles applied to the root element if variant="outlined"
and color="success"
.
Rule name:outlinedSuccess
Styles applied to the root element if variant="outlined"
and color="warning"
.
Rule name:outlinedWarning
Styles applied to the root element if size="medium"
.
Rule name:sizeMedium
Styles applied to the startIcon element if loading={true}
and loadingPosition="start"
.
Rule name:startIconLoadingStart
Styles applied to the root element if variant="text"
and color="error"
.
Rule name:textError
Styles applied to the root element if variant="text"
and color="info"
.
Rule name:textInfo
Styles applied to the root element if variant="text"
and color="inherit"
.
Rule name:textInherit
Styles applied to the root element if variant="text"
and color="primary"
.
Rule name:textPrimary
Styles applied to the root element if variant="text"
and color="secondary"
.
Rule name:textSecondary
Styles applied to the root element if size="large"
and variant="text"
.
Rule name:textSizeLarge
Styles applied to the root element if size="medium"
and variant="text"
.
Rule name:textSizeMedium
Styles applied to the root element if size="small"
and variant="text"
.
Rule name:textSizeSmall
Styles applied to the root element if variant="text"
and color="success"
.
Rule name:textSuccess
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.