@mui/material APIs
- Button
- IconButton
- Typography
- MenuItem
- Box
- Tooltip
- TextField
- CircularProgress
- FormControlLabel
- List
- Divider
- ListItem
- ListItemText
- Select
- Grid
- ThemeProvider
- FormControl
- Link
- useTheme
- InputLabel
- Paper
- Dialog
- DialogTitle
- Toolbar
- createTheme
- LinearProgress
- Container
- Checkbox
- ListItemIcon
- DialogContent
- Card
- CssBaseline
- Theme
- useMediaQuery
- Menu
- Alert
- Tab
- DialogActions
- AppBar
- Switch
- Drawer
- Chip
- InputAdornment
- Collapse
- Stack
- CardContent
- DialogContentText
- TableBody
- TableCell
- TableRow
- Skeleton
- Table
- Tabs
- Avatar
- Autocomplete
- FormGroup
- SelectChangeEvent
- Radio
- AlertTitle
- TableHead
- InputBase
- Input
- Snackbar
- TextFieldProps
- styled
- alpha
- TableContainer
- CardActions
- Badge
- CardHeader
- ListItemButton
- CardActionArea
- Modal
- AccordionDetails
- AccordionSummary
- ButtonProps
- StyledEngineProvider
- RadioGroup
- ListItemAvatar
- Fade
- CardMedia
- Accordion
- Slider
- FormLabel
- FormHelperText
- Popover
- Backdrop
- Popper
- ThemeOptions
- Zoom
- ToggleButton
- ToggleButtonGroup
- SxProps
- Fab
- TooltipProps
- IconButtonProps
- CircularProgressProps
- darken
- TextareaAutosize
- OutlinedInput
- Breadcrumbs
- Slide
- SwipeableDrawer
- ClickAwayListener
- SelectProps
- TypographyProps
- ButtonBase
- ListItemSecondaryAction
- SvgIcon
- Pagination
- tooltipClasses
- ButtonGroup
- Hidden
- debounce
- FilledInput
- lighten
- useScrollTrigger
- darkScrollbar
- PaletteMode
- SnackbarCloseReason
- MenuList
- SvgIconProps
- SnackbarProps
- AlertColor
- Icon
- TablePagination
- MenuItemProps
- Stepper
- Step
- StepLabel
- ownerWindow
- useForkRef
- AlertProps
- InputUnstyled
- Rating
- capitalize
- SpeedDial
- SpeedDialAction
- SpeedDialIcon
- BadgeProps
- createSvgIcon
- Grow
- linearProgressClasses
- PaletteColor
- BottomNavigation
- Palette
- responsiveFontSizes
- OutlinedInputProps
- TabProps
- NoSsr
- PaletteOptions
- ListSubheader
- ImageList
- StepConnector
- tableCellClasses
- TableSortLabel
Other Related APIs
- react#Suspense
- react#useMemo
- react-router-dom#Switch
- react-router-dom#Route
- next#NextApiRequest
- next#NextApiResponse
- react-toastify#ToastContainer
- @mui/material#CssBaseline
- @mui/material#ThemeProvider
- @mui/material#useMediaQuery
- @mui/material#createTheme
- @mui/material/styles#StyledEngineProvider
- recoil#atom
- recoil#useRecoilValue
- @mui/lab#LocalizationProvider
@mui/material#PaletteMode TypeScript Examples
The following examples show how to use
@mui/material#PaletteMode.
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: App.tsx From abrechnung with GNU Affero General Public License v3.0 | 5 votes |
export default function App() {
const darkModeSystem = useMediaQuery("(prefers-color-scheme: dark)");
const userThemeSettings = useRecoilValue(themeSettings);
const useDarkMode: PaletteMode =
userThemeSettings.darkMode === "browser" ? (darkModeSystem ? "dark" : "light") : userThemeSettings.darkMode;
const theme = useMemo(
() =>
createTheme({
palette: {
mode: useDarkMode,
},
}),
[useDarkMode]
);
return (
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<CssBaseline />
<LocalizationProvider dateAdapter={DateAdapter}>
<ToastContainer
position="top-right"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
/>
<Router>
<Switch>
{routes.map((route) => {
const authRoute = route.auth ? (
<AuthenticatedRoute>{route.component}</AuthenticatedRoute>
) : (
route.component
);
const layoutRoute =
route.layout === undefined || route.layout ? (
<Layout>
<Suspense fallback={<Loading />}>{authRoute}</Suspense>
</Layout>
) : (
<Suspense fallback={<Loading />}>{authRoute}</Suspense>
);
return (
<Route
key={route.path}
exact={route.exact !== undefined && route.exact}
path={route.path}
>
{layoutRoute}
</Route>
);
})}
</Switch>
</Router>
</LocalizationProvider>
</ThemeProvider>
</StyledEngineProvider>
);
}