-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Button] Add loading
prop
#44637
Open
siriwatknp
wants to merge
15
commits into
mui:master
Choose a base branch
from
siriwatknp:feat/button-loading3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+901
−1,588
Open
[Button] Add loading
prop
#44637
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
52f690e
Revert "[material-ui][Button] Revert Button loading (#44478)"
siriwatknp f317e69
add enableLoadingWrapper
siriwatknp ecdab2b
Merge branch 'master' of https://github.com/mui/material-ui into feat…
siriwatknp baf6709
Revert "add enableLoadingWrapper"
siriwatknp ce1206a
set loading default to null
siriwatknp 92a33b5
add warning
siriwatknp 33543e7
Merge branch 'master' of https://github.com/mui/material-ui into feat…
siriwatknp 6d404da
remove combined classes
siriwatknp 92d392e
remove loading from badge demo
siriwatknp 5ce445f
fix loading position without icon
siriwatknp 978a40e
run docs:api
siriwatknp 82f9be8
Merge branch 'master' of https://github.com/mui/material-ui into feat…
siriwatknp 65cfdbe
remove `order`
siriwatknp c9911ff
fix button loading position class
siriwatknp d3cf66a
run docs:api
siriwatknp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 3 additions & 4 deletions
7
docs/data/material/components/button-group/LoadingButtonGroup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import * as React from 'react'; | ||
import ButtonGroup from '@mui/material/ButtonGroup'; | ||
import Button from '@mui/material/Button'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
|
||
export default function LoadingButtonGroup() { | ||
return ( | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> | ||
); | ||
} |
7 changes: 3 additions & 4 deletions
7
docs/data/material/components/button-group/LoadingButtonGroup.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import * as React from 'react'; | ||
import ButtonGroup from '@mui/material/ButtonGroup'; | ||
import Button from '@mui/material/Button'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
|
||
export default function LoadingButtonGroup() { | ||
return ( | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> | ||
); | ||
} |
6 changes: 3 additions & 3 deletions
6
docs/data/material/components/button-group/LoadingButtonGroup.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<ButtonGroup variant="outlined" aria-label="Loading button group"> | ||
<Button>Submit</Button> | ||
<LoadingButton>Fetch data</LoadingButton> | ||
<LoadingButton loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
<Button>Fetch data</Button> | ||
<Button loading loadingPosition="start" startIcon={<SaveIcon />}> | ||
Save | ||
</LoadingButton> | ||
</Button> | ||
</ButtonGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
docs/data/material/components/buttons/IconButtonWithBadge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Badge, { badgeClasses } from '@mui/material/Badge'; | ||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCartOutlined'; | ||
|
||
const CartBadge = styled(Badge)` | ||
.${badgeClasses.badge} { | ||
top: -12px; | ||
right: -6px; | ||
} | ||
`; | ||
|
||
export default function IconButtonWithBadge() { | ||
return ( | ||
<IconButton> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
docs/data/material/components/buttons/IconButtonWithBadge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Badge, { badgeClasses } from '@mui/material/Badge'; | ||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCartOutlined'; | ||
|
||
const CartBadge = styled(Badge)` | ||
.${badgeClasses.badge} { | ||
top: -12px; | ||
right: -6px; | ||
} | ||
`; | ||
|
||
export default function IconButtonWithBadge() { | ||
return ( | ||
<IconButton> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> | ||
); | ||
} |
4 changes: 4 additions & 0 deletions
4
docs/data/material/components/buttons/IconButtonWithBadge.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<IconButton> | ||
<ShoppingCartIcon fontSize="small" /> | ||
<CartBadge badgeContent={2} color="primary" overlap="circular" /> | ||
</IconButton> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,61 @@ | ||
import * as React from 'react'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import Button from '@mui/material/Button'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function LoadingButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<LoadingButton loading variant="outlined"> | ||
Submit | ||
</LoadingButton> | ||
<LoadingButton loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</LoadingButton> | ||
<LoadingButton | ||
<Stack spacing={2}> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined"> | ||
Submit | ||
</Button> | ||
<Button loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</Button> | ||
<Button | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</LoadingButton> | ||
Full width | ||
</Button> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="end" | ||
endIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Full width | ||
</Button> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined" loadingPosition="start"> | ||
Submit | ||
</Button> | ||
<Button loading variant="outlined" loadingPosition="end"> | ||
Submit | ||
</Button> | ||
<Button | ||
loading | ||
variant="outlined" | ||
loadingPosition="end" | ||
startIcon={<SaveIcon />} | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,61 @@ | ||
import * as React from 'react'; | ||
import LoadingButton from '@mui/lab/LoadingButton'; | ||
import Button from '@mui/material/Button'; | ||
import SaveIcon from '@mui/icons-material/Save'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function LoadingButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<LoadingButton loading variant="outlined"> | ||
Submit | ||
</LoadingButton> | ||
<LoadingButton loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</LoadingButton> | ||
<LoadingButton | ||
<Stack spacing={2}> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined"> | ||
Submit | ||
</Button> | ||
<Button loading loadingIndicator="Loading…" variant="outlined"> | ||
Fetch data | ||
</Button> | ||
<Button | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="start" | ||
startIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Save | ||
</LoadingButton> | ||
Full width | ||
</Button> | ||
<Button | ||
fullWidth | ||
loading | ||
loadingPosition="end" | ||
endIcon={<SaveIcon />} | ||
variant="outlined" | ||
> | ||
Full width | ||
</Button> | ||
<Stack direction="row" spacing={2}> | ||
<Button loading variant="outlined" loadingPosition="start"> | ||
Submit | ||
</Button> | ||
<Button loading variant="outlined" loadingPosition="end"> | ||
Submit | ||
</Button> | ||
<Button | ||
loading | ||
variant="outlined" | ||
loadingPosition="end" | ||
startIcon={<SaveIcon />} | ||
> | ||
Save | ||
</Button> | ||
</Stack> | ||
</Stack> | ||
); | ||
} |
14 changes: 0 additions & 14 deletions
14
docs/data/material/components/buttons/LoadingButtons.tsx.preview
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.