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 of the Button component are also available.
Name | Type | Default | Description |
---|---|---|---|
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
disabled | bool | false | If |
loading | bool | false | If |
loadingIndicator | node | <CircularProgress color="inherit" size={16} /> | Element placed before the children if the button is in loading state. The node should contain an element with |
loadingPosition | 'start' | 'end' | 'center' | 'center' | The loading indicator can be positioned on the start, end, or the center of the button. |
sx | Array<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. |
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.
Class name | Rule name | Description |
---|---|---|
.Mui-disabled | State class applied to the root element if disabled={true} . | |
.Mui-focusVisible | State class applied to the ButtonBase root element if the button is keyboard focused. | |
.MuiLoadingButton-colorError | colorError | Styles applied to the root element if color="error" . |
.MuiLoadingButton-colorInfo | colorInfo | Styles applied to the root element if color="info" . |
.MuiLoadingButton-colorInherit | colorInherit | Styles applied to the root element if color="inherit" . |
.MuiLoadingButton-colorPrimary | colorPrimary | Styles applied to the root element if color="primary" . |
.MuiLoadingButton-colorSecondary | colorSecondary | Styles applied to the root element if color="secondary" . |
.MuiLoadingButton-colorSuccess | colorSuccess | Styles applied to the root element if color="success" . |
.MuiLoadingButton-colorWarning | colorWarning | Styles applied to the root element if color="warning" . |
.MuiLoadingButton-contained | contained | Styles applied to the root element if variant="contained" . |
.MuiLoadingButton-containedError | containedError | Styles applied to the root element if variant="contained" and color="error" . |
.MuiLoadingButton-containedInfo | containedInfo | Styles applied to the root element if variant="contained" and color="info" . |
.MuiLoadingButton-containedInherit | containedInherit | Styles applied to the root element if variant="contained" and color="inherit" . |
.MuiLoadingButton-containedPrimary | containedPrimary | Styles applied to the root element if variant="contained" and color="primary" . |
.MuiLoadingButton-containedSecondary | containedSecondary | Styles applied to the root element if variant="contained" and color="secondary" . |
.MuiLoadingButton-containedSizeLarge | containedSizeLarge | Styles applied to the root element if size="large" and variant="contained" . |
.MuiLoadingButton-containedSizeMedium | containedSizeMedium | Styles applied to the root element if size="medium" and variant="contained" . |
.MuiLoadingButton-containedSizeSmall | containedSizeSmall | Styles applied to the root element if size="small" and variant="contained" . |
.MuiLoadingButton-containedSuccess | containedSuccess | Styles applied to the root element if variant="contained" and color="success" . |
.MuiLoadingButton-containedWarning | containedWarning | Styles applied to the root element if variant="contained" and color="warning" . |
.MuiLoadingButton-disableElevation | disableElevation | Styles applied to the root element if disableElevation={true} . |
.MuiLoadingButton-endIcon | endIcon | Styles applied to the endIcon element if supplied. |
.MuiLoadingButton-endIconLoadingEnd | endIconLoadingEnd | Styles applied to the endIcon element if loading={true} and loadingPosition="end" . |
.MuiLoadingButton-fullWidth | fullWidth | Styles applied to the root element if fullWidth={true} . |
.MuiLoadingButton-icon | icon | Styles applied to the icon element if supplied |
.MuiLoadingButton-iconSizeLarge | iconSizeLarge | Styles applied to the icon element if supplied and size="large" . |
.MuiLoadingButton-iconSizeMedium | iconSizeMedium | Styles applied to the icon element if supplied and size="medium" . |
.MuiLoadingButton-iconSizeSmall | iconSizeSmall | Styles applied to the icon element if supplied and size="small" . |
.MuiLoadingButton-label | label | Styles applied to the span element that wraps the children. |
.MuiLoadingButton-loading | loading | Styles applied to the root element if loading={true} . |
.MuiLoadingButton-loadingIndicator | loadingIndicator | Styles applied to the loadingIndicator element. |
.MuiLoadingButton-loadingIndicatorCenter | loadingIndicatorCenter | Styles applied to the loadingIndicator element if loadingPosition="center" . |
.MuiLoadingButton-loadingIndicatorEnd | loadingIndicatorEnd | Styles applied to the loadingIndicator element if loadingPosition="end" . |
.MuiLoadingButton-loadingIndicatorStart | loadingIndicatorStart | Styles applied to the loadingIndicator element if loadingPosition="start" . |
.MuiLoadingButton-outlined | outlined | Styles applied to the root element if variant="outlined" . |
.MuiLoadingButton-outlinedError | outlinedError | Styles applied to the root element if variant="outlined" and color="error" . |
.MuiLoadingButton-outlinedInfo | outlinedInfo | Styles applied to the root element if variant="outlined" and color="info" . |
.MuiLoadingButton-outlinedInherit | outlinedInherit | Styles applied to the root element if variant="outlined" and color="inherit" . |
.MuiLoadingButton-outlinedPrimary | outlinedPrimary | Styles applied to the root element if variant="outlined" and color="primary" . |
.MuiLoadingButton-outlinedSecondary | outlinedSecondary | Styles applied to the root element if variant="outlined" and color="secondary" . |
.MuiLoadingButton-outlinedSizeLarge | outlinedSizeLarge | Styles applied to the root element if size="large" and variant="outlined" . |
.MuiLoadingButton-outlinedSizeMedium | outlinedSizeMedium | Styles applied to the root element if size="medium" and variant="outlined" . |
.MuiLoadingButton-outlinedSizeSmall | outlinedSizeSmall | Styles applied to the root element if size="small" and variant="outlined" . |
.MuiLoadingButton-outlinedSuccess | outlinedSuccess | Styles applied to the root element if variant="outlined" and color="success" . |
.MuiLoadingButton-outlinedWarning | outlinedWarning | Styles applied to the root element if variant="outlined" and color="warning" . |
.MuiLoadingButton-root | root | Styles applied to the root element. |
.MuiLoadingButton-sizeLarge | sizeLarge | Styles applied to the root element if size="large" . |
.MuiLoadingButton-sizeMedium | sizeMedium | Styles applied to the root element if size="medium" . |
.MuiLoadingButton-sizeSmall | sizeSmall | Styles applied to the root element if size="small" . |
.MuiLoadingButton-startIcon | startIcon | Styles applied to the startIcon element if supplied. |
.MuiLoadingButton-startIconLoadingStart | startIconLoadingStart | Styles applied to the startIcon element if loading={true} and loadingPosition="start" . |
.MuiLoadingButton-text | text | Styles applied to the root element if variant="text" . |
.MuiLoadingButton-textError | textError | Styles applied to the root element if variant="text" and color="error" . |
.MuiLoadingButton-textInfo | textInfo | Styles applied to the root element if variant="text" and color="info" . |
.MuiLoadingButton-textInherit | textInherit | Styles applied to the root element if variant="text" and color="inherit" . |
.MuiLoadingButton-textPrimary | textPrimary | Styles applied to the root element if variant="text" and color="primary" . |
.MuiLoadingButton-textSecondary | textSecondary | Styles applied to the root element if variant="text" and color="secondary" . |
.MuiLoadingButton-textSizeLarge | textSizeLarge | Styles applied to the root element if size="large" and variant="text" . |
.MuiLoadingButton-textSizeMedium | textSizeMedium | Styles applied to the root element if size="medium" and variant="text" . |
.MuiLoadingButton-textSizeSmall | textSizeSmall | Styles applied to the root element if size="small" and variant="text" . |
.MuiLoadingButton-textSuccess | textSuccess | Styles applied to the root element if variant="text" and color="success" . |
.MuiLoadingButton-textWarning | textWarning | Styles 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:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.