-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[ButtonGroup] Add orientation prop #18762
Merged
oliviertassinari
merged 17 commits into
mui:master
from
SandraMarcelaHerreraArriaga:ButtonGroup-Support-vertical-option
Dec 12, 2019
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dde801a
add orientation prop
SandraMarcelaHerreraArriaga 248a426
add orientation prop to docs:api
SandraMarcelaHerreraArriaga da26f6d
fix code to keep root style rule first
SandraMarcelaHerreraArriaga fb3d106
typescript definitions
SandraMarcelaHerreraArriaga 83c29e0
fix sort asc orientation prop
SandraMarcelaHerreraArriaga 34354d0
yarn prettier
SandraMarcelaHerreraArriaga 978b09a
yarn docs:api
SandraMarcelaHerreraArriaga 5d7b20a
fix declarations: sorted alphabetically react/sort-prop-types
SandraMarcelaHerreraArriaga 21b4d25
yarn docs:api
SandraMarcelaHerreraArriaga 3c26c4c
fix yarn prettier
SandraMarcelaHerreraArriaga c641f15
update typescript classes
oliviertassinari 606443e
Update packages/material-ui/src/ButtonGroup/ButtonGroup.js
SandraMarcelaHerreraArriaga a894ea4
yarn docs:typescript:formatted
SandraMarcelaHerreraArriaga 664bd67
yarn prettier
SandraMarcelaHerreraArriaga 7de7d54
demo add orientation prop
SandraMarcelaHerreraArriaga c786c04
break down demos :)
oliviertassinari 267b7f3
show colors too
oliviertassinari 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
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
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
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,17 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
|
||
export default function GroupOrientation() { | ||
return ( | ||
<ButtonGroup | ||
orientation="vertical" | ||
color="primary" | ||
aria-label="vertical outlined primary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
|
||
export default function GroupOrientation() { | ||
return ( | ||
<ButtonGroup | ||
orientation="vertical" | ||
color="primary" | ||
aria-label="vertical outlined primary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
})); | ||
|
||
export default function GroupSizesColors() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<ButtonGroup size="small" aria-label="small outlined button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup color="secondary" aria-label="outlined secondary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup size="large" color="primary" aria-label="large outlined primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</div> | ||
); | ||
} |
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,41 @@ | ||
import React from 'react'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
}), | ||
); | ||
|
||
export default function GroupSizesColors() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<ButtonGroup size="small" aria-label="small outlined button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup color="secondary" aria-label="outlined secondary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup size="large" color="primary" aria-label="large outlined primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</div> | ||
); | ||
} |
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,115 +1,39 @@ | ||
import React from 'react'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
})); | ||
|
||
export default function GroupedButtons() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Grid container spacing={3}> | ||
<Grid item xs={12} md={6}> | ||
<Grid container spacing={1} direction="column" alignItems="center"> | ||
<Grid item> | ||
<ButtonGroup size="small" aria-label="small outlined button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup color="primary" aria-label="outlined primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup | ||
color="secondary" | ||
size="large" | ||
aria-label="large outlined secondary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<Grid container spacing={1} direction="column" alignItems="center"> | ||
<Grid item> | ||
<ButtonGroup variant="contained" size="small" aria-label="small contained button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup | ||
variant="contained" | ||
color="primary" | ||
aria-label="full-width contained primary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup | ||
variant="contained" | ||
color="secondary" | ||
size="large" | ||
aria-label="large contained secondary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<Grid container spacing={1} direction="column" alignItems="center"> | ||
<Grid item> | ||
<ButtonGroup variant="text" size="small" aria-label="small contained button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup | ||
variant="text" | ||
color="primary" | ||
aria-label="full-width contained primary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
<Grid item> | ||
<ButtonGroup | ||
variant="text" | ||
color="secondary" | ||
size="large" | ||
aria-label="large contained secondary button group" | ||
> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<ButtonGroup fullWidth aria-label="full width outlined button group"> | ||
<Button>Full</Button> | ||
<Button>width</Button> | ||
<Button>Group</Button> | ||
</ButtonGroup> | ||
</Grid> | ||
</Grid> | ||
<div className={classes.root}> | ||
<ButtonGroup color="primary" aria-label="outlined primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup variant="contained" color="primary" aria-label="contained primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
<ButtonGroup variant="text" color="primary" aria-label="text primary button group"> | ||
<Button>One</Button> | ||
<Button>Two</Button> | ||
<Button>Three</Button> | ||
</ButtonGroup> | ||
</div> | ||
); | ||
} |
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.
@mbrookes one step at the time 👼.