@material-ui/core APIs
- Typography
- Button
- Grid
- TextField
- IconButton
- Paper
- Card
- MenuItem
- AppBar
- Container
- Toolbar
- makeStyles
- Divider
- ListItem
- Tooltip
- CardContent
- CircularProgress
- Box
- List
- Avatar
- FormControl
- ListItemText
- Dialog
- Select
- DialogContent
- Link
- DialogTitle
- CssBaseline
- FormControlLabel
- InputLabel
- DialogActions
- Checkbox
- TableBody
- Menu
- Table
- TableHead
- TableRow
- Drawer
- TableCell
- createMuiTheme
- Tabs
- Tab
- Hidden
- Switch
- InputAdornment
- ThemeProvider
- CardHeader
- Snackbar
- ListItemIcon
- CardActions
- Chip
- LinearProgress
- Input
- DialogContentText
- Collapse
- useMediaQuery
- CardMedia
- TableContainer
- Badge
- Fab
- withStyles
- ListItemAvatar
- ButtonGroup
- Modal
- CardActionArea
- FormGroup
- Radio
- InputBase
- useTheme
- FormHelperText
- ListSubheader
- RadioGroup
- SvgIcon
- ClickAwayListener
- TablePagination
- Slide
- Fade
- Stepper
- StepLabel
- Popover
- Slider
- Accordion
- AccordionSummary
- colors
- Step
- FormLabel
- AccordionDetails
- ExpansionPanel
- ExpansionPanelSummary
- ExpansionPanelDetails
- Backdrop
- Breadcrumbs
- Icon
- ListItemSecondaryAction
- createTheme
- Zoom
- TableSortLabel
- MuiThemeProvider
- TextareaAutosize
- ButtonBase
- StepContent
- createStyles
- NativeSelect
- Grow
- MenuList
- Popper
- useScrollTrigger
- OutlinedInput
- GridList
- GridListTile
- GridListTileBar
- TableFooter
- BottomNavigation
- BottomNavigationAction
- SnackbarContent
- withWidth
- responsiveFontSizes
- capitalize
- green
- lighten
- MobileStepper
- isWidthUp
- ImageList
- ImageListItem
- ImageListItemBar
- ServerStyleSheets
- SwipeableDrawer
- Stack
- Autocomplete
- Rating
- fade
- withMobileDialog
- RootRef
- createSvgIcon
- ExpansionPanelActions
- styled
- alpha
OtherRelated APIs
@material-ui/core#ServerStyleSheets JavaScript Examples
The following examples show how to use
@material-ui/core#ServerStyleSheets.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: _document.js From flame-coach-web with MIT License | 5 votes |
// `getInitialProps` belongs to `_document` (instead of `_app`),
// it's compatible with server-side generation (SSG).
MyDocument.getInitialProps = async (ctx) => {
// Resolution order
//
// On the server:
// 1. app.getInitialProps
// 2. page.getInitialProps
// 3. document.getInitialProps
// 4. app.render
// 5. page.render
// 6. document.render
//
// On the server with error:
// 1. document.getInitialProps
// 2. app.render
// 3. page.render
// 4. document.render
//
// On the client
// 1. app.getInitialProps
// 2. page.getInitialProps
// 3. app.render
// 4. page.render
// Render app and page and get the context of the page with collected side effects.
const sheets = new ServerStyleSheets();
const originalRenderPage = ctx.renderPage;
ctx.renderPage = () => originalRenderPage({
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />)
});
const initialProps = await Document.getInitialProps(ctx);
return {
...initialProps,
// Styles fragment is rendered after the app and page rendering finish.
styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()]
};
};