Skip to content
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

[Container] Document the classes API #15919

Merged
merged 2 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/material-ui/src/Container/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { withStyles } from '../styles';
import { capitalize } from '../utils';

export const styles = theme => ({
/* Styles applied to the root element. */
root: {
width: '100%',
marginLeft: 'auto',
Expand All @@ -21,6 +22,7 @@ export const styles = theme => ({
paddingRight: theme.spacing(4),
},
},
/* Styles applied to the root element if `fixed={true}`. */
fixed: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
const value = theme.breakpoints.values[breakpoint];

Expand All @@ -31,26 +33,31 @@ export const styles = theme => ({
}
return acc;
}, {}),
/* Styles applied to the root element if `maxWidth="xs"`. */
maxWidthXs: {
[theme.breakpoints.up('xs')]: {
maxWidth: Math.max(theme.breakpoints.values.xs, 444),
},
},
/* Styles applied to the root element if `maxWidth="sm"`. */
maxWidthSm: {
[theme.breakpoints.up('sm')]: {
maxWidth: theme.breakpoints.values.sm,
},
},
/* Styles applied to the root element if `maxWidth="md"`. */
maxWidthMd: {
[theme.breakpoints.up('md')]: {
maxWidth: theme.breakpoints.values.md,
},
},
/* Styles applied to the root element if `maxWidth="lg"`. */
maxWidthLg: {
[theme.breakpoints.up('lg')]: {
maxWidth: theme.breakpoints.values.lg,
},
},
/* Styles applied to the root element if `maxWidth="xl"`. */
maxWidthXl: {
[theme.breakpoints.up('xl')]: {
maxWidth: theme.breakpoints.values.xl,
Expand Down
17 changes: 10 additions & 7 deletions pages/api/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ Any other properties supplied will be provided to the root element (native eleme
You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:

- `root`
- `fixed`
- `maxWidthXs`
- `maxWidthSm`
- `maxWidthMd`
- `maxWidthLg`
- `maxWidthXl`

| Name | Description |
|:-----|:------------|
| <span class="prop-name">root</span> | Styles applied to the root element.
| <span class="prop-name">fixed</span> | Styles applied to the root element if `fixed={true}`.
| <span class="prop-name">maxWidthXs</span> | Styles applied to the root element if `maxWidth="xs"`.
| <span class="prop-name">maxWidthSm</span> | Styles applied to the root element if `maxWidth="sm"`.
| <span class="prop-name">maxWidthMd</span> | Styles applied to the root element if `maxWidth="md"`.
| <span class="prop-name">maxWidthLg</span> | Styles applied to the root element if `maxWidth="lg"`.
| <span class="prop-name">maxWidthXl</span> | Styles applied to the root element if `maxWidth="xl"`.

Have a look at the [overriding styles with classes](/customization/components/#overriding-styles-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Container/Container.js)
Expand Down