@material-ui/core APIs
- Button
- Typography
- IconButton
- Grid
- TextField
- makeStyles
- Box
- List
- ListItem
- CircularProgress
- ListItemText
- Paper
- Divider
- Tooltip
- DialogContent
- Toolbar
- AppBar
- Card
- Dialog
- Container
- DialogTitle
- FormControl
- MenuItem
- Theme
- FormControlLabel
- CardContent
- CssBaseline
- DialogActions
- createStyles
- Select
- Link
- Checkbox
- DialogContentText
- Snackbar
- TableCell
- TableRow
- Table
- TableBody
- useMediaQuery
- InputAdornment
- ListItemIcon
- Switch
- Chip
- TableHead
- InputLabel
- withStyles
- Avatar
- ThemeProvider
- Drawer
- LinearProgress
- Menu
- CardActions
- createMuiTheme
- TableContainer
- Tab
- Tabs
- Slider
- ListItemSecondaryAction
- useTheme
- CardHeader
- Collapse
- Popover
- Radio
- Hidden
- FormGroup
- Fade
- InputBase
- FormHelperText
- ListSubheader
- Fab
- Input
- Badge
- Step
- AccordionDetails
- AccordionSummary
- RadioGroup
- ButtonGroup
- Slide
- ListItemAvatar
- Stepper
- SvgIcon
- Accordion
- StepLabel
- Modal
- FormLabel
- ClickAwayListener
- ButtonProps
- WithStyles
- Backdrop
- Popper
- createTheme
- ButtonBase
- CardMedia
- MuiThemeProvider
- OutlinedInput
- TextFieldProps
- Grow
- TablePagination
- TextareaAutosize
- darken
- CardActionArea
- TypographyProps
- StepButton
- SelectProps
- Zoom
- TableSortLabel
- styled
- lighten
- InputProps
- GridProps
- fade
- ThemeOptions
- BoxProps
- ExpansionPanel
- ExpansionPanelSummary
- ExpansionPanelDetails
- useScrollTrigger
- TooltipProps
- PopoverProps
- MobileStepper
- TableFooter
- Icon
- debounce
- Breadcrumbs
- BottomNavigation
- StepConnector
- SwipeableDrawer
- ButtonBaseProps
- MenuList
- DialogProps
- Portal
- SvgIconTypeMap
- capitalize
- alpha
- colors
- InputBaseProps
- NativeSelect
- ChipProps
- IconButtonProps
- emphasize
- SnackbarContent
- PaletteType
- CheckboxProps
- GridSize
- GridItemsAlignment
- SvgIconProps
- SnackbarOrigin
- NoSsr
- withTheme
- WithTheme
- TextareaAutosizeProps
- ExpansionPanelActions
- createSvgIcon
- SnackbarContentProps
- BreadcrumbsProps
- LinearProgressProps
- responsiveFontSizes
- ThemeProviderProps
- GridSpacing
- SliderTypeMap
- TabsActions
- PaperProps
- SnackbarCloseReason
- Alert
- Stack
- Skeleton
- ExtendButton
- ExtendButtonBase
- AlertProps
- ImageList
- ImageListItem
- StepContent
- getLuminance
- LinkProps
- StepIconProps
- ToolbarProps
- isWidthUp
- WithWidthProps
- isWidthDown
- PopperProps
- Options
- ServerStyleSheets
- WithWidth
- BottomNavigationAction
- InputAdornmentProps
- FormControlProps
- hexToRgb
- ListItemProps
- AppBarProps
- TypographyClassKey
- Autocomplete
- StylesProvider
Other Related APIs
@material-ui/core#ThemeOptions TypeScript Examples
The following examples show how to use
@material-ui/core#ThemeOptions.
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: theme.ts From interface-v2 with GNU General Public License v3.0 | 5 votes |
function createQuickTheme(
custom: any,
options?: ThemeOptions | undefined,
...args: any[]
) {
return createTheme(merge(custom, options), ...args);
}
Example #2
Source File: AppContext.tsx From firetable with Apache License 2.0 | 4 votes |
AppProvider: React.FC = ({ children }) => {
// Store currentUser from Firebase Auth
const [currentUser, setCurrentUser] = useState<
firebase.User | null | undefined
>();
useEffect(() => {
auth.onAuthStateChanged((auth) => {
setCurrentUser(auth);
});
}, []);
// Store matching userDoc
const [userDoc, dispatchUserDoc] = useDoc({});
// Get userDoc
useEffect(() => {
if (currentUser) {
analytics.setUserId(currentUser.uid);
analytics.setUserProperties({
ft_instance: window.location.hostname,
});
dispatchUserDoc({ path: `_FT_USERS/${currentUser.uid}` });
}
}, [currentUser]);
// Infer theme based on system settings
const prefersDarkTheme = useMediaQuery("(prefers-color-scheme: dark)", {
noSsr: true,
});
// Store theme
const [theme, setTheme] = useThemeState<keyof typeof Themes>(
prefersDarkTheme ? "dark" : "light"
);
// Store if theme was overridden
const [themeOverridden, setThemeOverridden] = useThemeOverriddenState(false);
// Update theme when system settings change
useEffect(() => {
if (themeOverridden) return;
if (prefersDarkTheme && theme !== "dark") setTheme("dark");
if (!prefersDarkTheme && theme !== "light") setTheme("light");
}, [prefersDarkTheme, themeOverridden]);
// Store themeCustomization from userDoc
const [themeCustomization, setThemeCustomization] = useState<ThemeOptions>(
{}
);
const generatedTheme = Themes[theme](themeCustomization);
useEffect(() => {
if (userDoc.doc) {
// Set theme customizations from user doc
setThemeCustomization(userDoc.doc.theme);
} else if (
!userDoc.doc &&
!userDoc.loading &&
userDoc.path &&
currentUser
) {
// Set userDoc if it doesn’t exist
const userFields = ["email", "displayName", "photoURL", "phoneNumber"];
const userData = userFields.reduce((acc, curr) => {
if (currentUser[curr]) {
return { ...acc, [curr]: currentUser[curr] };
}
return acc;
}, {});
db.doc(userDoc.path).set(
{
tables: {},
user: userData,
theme: {
palette: {
primary: { main: "#ef4747" },
},
},
},
{ merge: true }
);
}
}, [userDoc]);
return (
<AppContext.Provider
value={{
userDoc: { state: userDoc, dispatch: dispatchUserDoc },
currentUser,
theme,
themeOverridden,
setTheme,
setThemeOverridden,
}}
>
<MuiThemeProvider theme={generatedTheme}>
<CssBaseline />
<ErrorBoundary>{children}</ErrorBoundary>
</MuiThemeProvider>
</AppContext.Provider>
);
}