Skip to content

Commit

Permalink
render indicator only when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Nov 7, 2024
1 parent 23d8200 commit ae62a4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/mui-material/src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const ButtonRoot = styled(ButtonBase, {
style: { width: '100%' },
},
{
props: { fullWidth: true, loading: true, loadingPosition: 'start' },
props: { fullWidth: true, loading: true, loadingPosition: 'end' },
style: { flexDirection: 'row-reverse' },
},
{
Expand Down Expand Up @@ -583,7 +583,7 @@ const Button = React.forwardRef(function Button(inProps, ref) {

const loader = (
<ButtonLoadingIndicator className={classes.loadingIndicator} ownerState={ownerState}>
{loadingIndicator}
{loading && loadingIndicator}
</ButtonLoadingIndicator>
);

Expand All @@ -604,8 +604,8 @@ const Button = React.forwardRef(function Button(inProps, ref) {
classes={classes}
>
{startIcon}
{children}
{loader}
{children}
{endIcon}
</ButtonRoot>
);
Expand Down

0 comments on commit ae62a4d

Please sign in to comment.