-
-
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
[material-ui][docs] Revise the Button page #40446
Changes from 16 commits
bacd747
a6e24c0
5315fd4
4aee079
29e75ac
cf61e88
ceda1d0
20e3d1c
a921791
f3ea3da
90d203a
c485aa2
9c33cf9
83a1833
1d5bde0
8b63b94
e30185d
7a73034
692cb5c
0725e8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
|
||
export default function DisableElevation() { | ||
return ( | ||
<Button variant="contained" disableElevation> | ||
Disable elevation | ||
</Button> | ||
<Stack spacing={2} direction="row"> | ||
<Button variant="contained">Default</Button> | ||
<Button variant="contained" disableElevation> | ||
Elevation disabled | ||
</Button> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
|
||
export default function DisableElevation() { | ||
return ( | ||
<Button variant="contained" disableElevation> | ||
Disable elevation | ||
</Button> | ||
<Stack spacing={2} direction="row"> | ||
<Button variant="contained">Default</Button> | ||
<Button variant="contained" disableElevation> | ||
Elevation disabled | ||
</Button> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<Button variant="contained">Default</Button> | ||
<Button variant="contained" disableElevation> | ||
Disable elevation | ||
Elevation disabled | ||
</Button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
|
||
export default function DisabledButton() { | ||
return ( | ||
<Stack spacing={2} direction="row"> | ||
<Button variant="outlined">Default</Button> | ||
<Button variant="outlined" disabled> | ||
Click disabled | ||
</Button> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from 'react'; | ||
import Stack from '@mui/material/Stack'; | ||
import Button from '@mui/material/Button'; | ||
|
||
export default function DisabledButton() { | ||
return ( | ||
<Stack spacing={2} direction="row"> | ||
<Button variant="outlined">Default</Button> | ||
<Button variant="outlined" disabled> | ||
Click disabled | ||
</Button> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<Button variant="outlined">Default</Button> | ||
<Button variant="outlined" disabled> | ||
Click disabled | ||
</Button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Button from '@mui/material/Button'; | ||
|
||
export default function FullWidthButton() { | ||
return ( | ||
<Box | ||
sx={{ | ||
width: '300px', | ||
border: '1px solid gray', | ||
borderRadius: '5px', | ||
padding: '5px', | ||
}} | ||
> | ||
<Button variant="contained" fullWidth> | ||
Full width button | ||
</Button> | ||
</Box> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||||||||||||||||||||||||||||||
import * as React from 'react'; | ||||||||||||||||||||||||||||||||||
import Box from '@mui/material/Box'; | ||||||||||||||||||||||||||||||||||
import Button from '@mui/material/Button'; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
export default function FullWidthButton() { | ||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||
<Box | ||||||||||||||||||||||||||||||||||
sx={{ | ||||||||||||||||||||||||||||||||||
width: '300px', | ||||||||||||||||||||||||||||||||||
border: '1px solid gray', | ||||||||||||||||||||||||||||||||||
borderRadius: '5px', | ||||||||||||||||||||||||||||||||||
padding: '5px', | ||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||
Comment on lines
+7
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To get the inline preview?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was about to suggest whether we need the 300px width limit there... I think we can make this one span the full demo container width, given it's illustrating the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A direction that makes sense to me:
Edit: actually, more padding y than padding x could make it 🤌 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about the background, though; it looks cleaner without it (plus all the other demos don't use it). |
||||||||||||||||||||||||||||||||||
<Button variant="contained" fullWidth> | ||||||||||||||||||||||||||||||||||
Full width button | ||||||||||||||||||||||||||||||||||
</Button> | ||||||||||||||||||||||||||||||||||
</Box> | ||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Button variant="contained" fullWidth> | ||
Full width button | ||
</Button> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
import Button from '@mui/material/Button'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function IntroButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<Button disabled>Go back</Button> | ||
<Button | ||
variant="outlined" | ||
startIcon={<DeleteIcon />} | ||
color="error" | ||
onClick={() => { | ||
alert('Canceled.'); | ||
}} | ||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
variant="contained" | ||
startIcon={<CheckIcon />} | ||
onClick={() => { | ||
alert('Confirmed.'); | ||
}} | ||
> | ||
Confirm | ||
</Button> | ||
</Stack> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from 'react'; | ||
import Button from '@mui/material/Button'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
import Stack from '@mui/material/Stack'; | ||
|
||
export default function IntroButtons() { | ||
return ( | ||
<Stack direction="row" spacing={2}> | ||
<Button disabled>Go back</Button> | ||
<Button | ||
variant="outlined" | ||
startIcon={<DeleteIcon />} | ||
color="error" | ||
onClick={() => { | ||
alert('Canceled.'); | ||
}} | ||
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To consider if we should remove the onClick to get the "inline preview" |
||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
variant="contained" | ||
startIcon={<CheckIcon />} | ||
onClick={() => { | ||
alert('Confirmed.'); | ||
}} | ||
> | ||
Confirm | ||
</Button> | ||
</Stack> | ||
); | ||
} |
This file was deleted.
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.
We can't do this yet, but this could make a lot of sense for v6 #40594.