The container centers your content horizontally. It's the most basic layout element.
While containers can be nested, most layouts do not require a nested container.
A fluid container width is bounded by the maxWidth
prop value.
import * as React from 'react';
import CssBaseline from '@mui/material/CssBaseline';
import Box from '@mui/material/Box';
import Container from '@mui/material/Container';
export default function SimpleContainer() {
return (
<React.Fragment>
<CssBaseline />
<Container maxWidth="sm">
<Box sx={{ bgcolor: '#cfe8fc', height: '100vh' }} />
</Container>
</React.Fragment>
);
}
<Container maxWidth="sm">
If you prefer to design for a fixed set of sizes instead of trying to accommodate a fully fluid viewport, you can set the fixed
prop.
The max-width matches the min-width of the current breakpoint.
import * as React from 'react';
import CssBaseline from '@mui/material/CssBaseline';
import Box from '@mui/material/Box';
import Container from '@mui/material/Container';
export default function FixedContainer() {
return (
<React.Fragment>
<CssBaseline />
<Container fixed>
<Box sx={{ bgcolor: '#cfe8fc', height: '100vh' }} />
</Container>
</React.Fragment>
);
}
<Container fixed>
The PageContainer component in @toolpad/core
is the ideal wrapper for the content of your dashboard. It makes the Material UI Container navigation-aware and extends it with page title, breadcrumbs, actions, and more.
{{“demo”: “…/breadcrumbs/PageContainerBasic.js”, “height”: 400, “bg”: “inline”, “defaultExpanded”: false}}