@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
- react#useState
- react#Fragment
- react#useRef
- react#MouseEventHandler
- react-router-dom#Link
- @material-ui/core#Box
- @material-ui/core#Tooltip
- @material-ui/core#IconButton
- @material-ui/core#ListItemText
- @material-ui/core#ListItemIcon
- @material-ui/core#Divider
- @material-ui/core#ListItemSecondaryAction
- @material-ui/core#Paper
- @material-ui/core#Avatar
- @material-ui/core#Badge
- @material-ui/core#ListItemAvatar
- @material-ui/core#MenuItem
- @material-ui/core#Menu
- @material-ui/core#makeStyles
- @material-ui/core#createStyles
@material-ui/core#IconButtonProps TypeScript Examples
The following examples show how to use
@material-ui/core#IconButtonProps.
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: UserMenu.tsx From firetable with Apache License 2.0 | 4 votes |
export default function UserMenu(props: IconButtonProps) {
const classes = useStyles();
const anchorEl = useRef<HTMLButtonElement>(null);
const [open, setOpen] = useState(false);
const [themeSubMenu, setThemeSubMenu] = useState<EventTarget | null>(null);
const [latestUpdate] = useLatestUpdateState<null | Record<string, any>>();
const {
currentUser,
userDoc,
theme,
themeOverridden,
setTheme,
setThemeOverridden,
} = useAppContext();
if (!currentUser || !userDoc || !userDoc?.state?.doc)
return <div className={classes.spacer} />;
const displayName = userDoc?.state?.doc?.user?.displayName;
const avatarUrl = userDoc?.state?.doc?.user?.photoURL;
const email = userDoc?.state?.doc?.user?.email;
const avatar = avatarUrl ? (
<Avatar src={avatarUrl} className={classes.avatar} />
) : (
<AccountCircleIcon color="secondary" />
);
const changeTheme = (option: "system" | "light" | "dark") => {
switch (option) {
case "system":
setThemeOverridden(false);
return;
case "light":
setTheme("light");
break;
case "dark":
setTheme("dark");
break;
default:
break;
}
setThemeOverridden(true);
};
return (
<>
<IconButton
aria-label="Open user menu"
aria-controls="user-menu"
aria-haspopup="true"
edge="end"
{...props}
ref={anchorEl}
onClick={() => setOpen(true)}
className={classes.iconButton}
>
{latestUpdate?.tag_name > "v" + meta.version ? (
<Badge color="primary" overlap="circular" variant="dot">
{avatar}
</Badge>
) : (
avatar
)}
</IconButton>
<Menu
anchorEl={anchorEl.current}
id="user-menu"
keepMounted
anchorOrigin={{ vertical: "bottom", horizontal: "right" }}
getContentAnchorEl={null}
transformOrigin={{ vertical: "top", horizontal: "right" }}
open={open}
onClose={() => setOpen(false)}
classes={{ paper: classes.paper }}
>
<MenuItem
component="a"
href={`https://console.firebase.google.com/project/${projectId}/firestore/data/~2F_FT_USERS~2F${currentUser.uid}`}
target="_blank"
rel="noopener"
>
<ListItemAvatar>{avatar}</ListItemAvatar>
<ListItemText primary={displayName} secondary={email} />
</MenuItem>
<Divider className={classes.divider} />
<MenuItem onClick={(e) => setThemeSubMenu(e.target)}>
Theme
<ListItemSecondaryAction className={classes.secondaryAction}>
<ArrowRightIcon className={classes.secondaryIcon} />
</ListItemSecondaryAction>
</MenuItem>
{themeSubMenu && (
<Menu
anchorEl={themeSubMenu as any}
id="theme-sub-menu"
anchorOrigin={{ vertical: "top", horizontal: "left" }}
getContentAnchorEl={null}
transformOrigin={{ vertical: "top", horizontal: "right" }}
open
onClose={() => setThemeSubMenu(null)}
classes={{ paper: classes.subMenu }}
>
<MenuItem onClick={() => changeTheme("system")}>
<ListItemIcon>{!themeOverridden && <CheckIcon />}</ListItemIcon>
System
</MenuItem>
<MenuItem onClick={() => changeTheme("light")}>
<ListItemIcon>
{themeOverridden && theme === "light" && <CheckIcon />}
</ListItemIcon>
Light
</MenuItem>
<MenuItem onClick={() => changeTheme("dark")}>
<ListItemIcon>
{themeOverridden && theme === "dark" && <CheckIcon />}
</ListItemIcon>
Dark
</MenuItem>
</Menu>
)}
<MenuItem component={Link} to={routes.signOut}>
Sign out
</MenuItem>
<Divider className={classes.divider} />
<UpdateChecker />
</Menu>
</>
);
}