@mui/material#ListItemIcon JavaScript Examples
The following examples show how to use
@mui/material#ListItemIcon.
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: SideBarItem.component.jsx From Stackoverflow-Clone-Frontend with MIT License | 6 votes |
DefaultItem = ({ link, icon, text }) => (
<NavLink
activeClassName='active'
className='icon-link nav-link'
to={link}
>
<ListItem disablePadding>
<ListItemButton className='menu-list-btn'>
<ListItemIcon className='menu-list-icon'>
{icon}
</ListItemIcon>
<ListItemText className='menu-list-text' primary={text}/>
</ListItemButton>
</ListItem>
</NavLink>
)
Example #2
Source File: Alphabetical.jsx From Edlib with GNU General Public License v3.0 | 6 votes |
Alphabetical = ({ allH5ps, contentTypes }) => {
const { classes } = useStyles();
return (
<List dense component="div" disablePadding>
{allH5ps.map((h5p, index) => (
<ListItem
key={index}
button
dense
onClick={() => contentTypes.toggle(h5p)}
>
<ListItemIcon
classes={{
root: classes.listItemIcon,
}}
>
<Checkbox
size="small"
edge="start"
checked={contentTypes.has(h5p)}
tabIndex={-1}
disableRipple
color="primary"
classes={{
root: classes.checkboxRoot,
}}
/>
</ListItemIcon>
<ListItemText
primary={`${h5p.title} (${h5p.filteredCount})`}
/>
</ListItem>
))}
</List>
);
}
Example #3
Source File: index.js From fireact with MIT License | 6 votes |
AppMenu = () => {
return (
<List>
<Link to="/" style={{textDecoration:'none'}}>
<ListItem button key="My Accounts">
<ListItemIcon><AppIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">My Accounts</Typography>} />
</ListItem>
</Link>
<Divider />
<Link to="/user/profile" style={{textDecoration:'none'}}>
<ListItem button key="Profile">
<ListItemIcon><AccountBoxIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">Profile</Typography>} />
</ListItem>
</Link>
<Link to="/user/log" style={{textDecoration:'none'}}>
<ListItem button key="Activity Logs">
<ListItemIcon><ListAltIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">Activity Logs</Typography>} />
</ListItem>
</Link>
</List>
)
}
Example #4
Source File: AccountInformationArea.js From react-saas-template with MIT License | 6 votes |
function AccountInformationArea(props) {
const { classes, toggleAccountActivation, isAccountActivated } = props;
return (
<Paper className={classes.paper}>
<Toolbar className={classes.toolbar}>
<Box display="flex" alignItems="center">
<Box mr={2}>
<ListItemText
primary="Status"
secondary={isAccountActivated ? "Activated" : "Not activated"}
className="mr-2"
/>
</Box>
<ListItemIcon>
<LoopIcon
className={classNames(
isAccountActivated ? classes.spin : null,
classes.scaleMinus
)}
/>
</ListItemIcon>
</Box>
<ListItemSecondaryAction className={classes.listItemSecondaryAction}>
<Switch
color="secondary"
checked={isAccountActivated}
onClick={toggleAccountActivation}
inputProps={{
"aria-label": isAccountActivated
? "Deactivate Account"
: "Activate Account"
}}
/>
</ListItemSecondaryAction>
</Toolbar>
</Paper>
);
}
Example #5
Source File: UserMoreMenu.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
// ----------------------------------------------------------------------
export default function UserMoreMenu() {
const ref = useRef(null);
const [isOpen, setIsOpen] = useState(false);
return (
<>
<IconButton ref={ref} onClick={() => setIsOpen(true)}>
<Iconify icon="eva:more-vertical-fill" width={20} height={20} />
</IconButton>
<Menu
open={isOpen}
anchorEl={ref.current}
onClose={() => setIsOpen(false)}
PaperProps={{
sx: { width: 200, maxWidth: '100%' },
}}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
>
<MenuItem sx={{ color: 'text.secondary' }}>
<ListItemIcon>
<Iconify icon="eva:trash-2-outline" width={24} height={24} />
</ListItemIcon>
<ListItemText primary="Delete" primaryTypographyProps={{ variant: 'body2' }} />
</MenuItem>
<MenuItem component={RouterLink} to="#" sx={{ color: 'text.secondary' }}>
<ListItemIcon>
<Iconify icon="eva:edit-fill" width={24} height={24} />
</ListItemIcon>
<ListItemText primary="Edit" primaryTypographyProps={{ variant: 'body2' }} />
</MenuItem>
</Menu>
</>
);
}
Example #6
Source File: Licenses.jsx From Edlib with GNU General Public License v3.0 | 5 votes |
Licenses = ({ licenses, filterCount, licenseData }) => {
const { t } = useTranslation();
const { classes } = useStyles();
return (
<List dense component="div" disablePadding className={classes.nested}>
{licenseData
.map((item) => {
const parts = item.id.split('-');
const count = filterCount.find(
(filterCount) =>
filterCount.key === item.id.toLowerCase()
);
return {
title: parts
.map((part) => t(`licenses.${part}`))
.join(' - '),
value: item.id,
filteredCount: count ? count.count : 0,
};
})
.sort((a, b) =>
a.title < b.title ? -1 : a.title > b.title ? 1 : 0
)
.map((license) => (
<ListItem
key={license.value}
button
dense
onClick={() => licenses.toggle(license)}
>
<ListItemIcon
classes={{
root: classes.listItemIcon,
}}
>
<Checkbox
size="small"
edge="start"
checked={licenses.has(license)}
tabIndex={-1}
disableRipple
color="primary"
classes={{
root: classes.checkboxRoot,
}}
/>
</ListItemIcon>
<ListItemText
primary={`${license.title} (${license.filteredCount})`}
/>
</ListItem>
))}
</List>
);
}
Example #7
Source File: SavedFilters.jsx From Edlib with GNU General Public License v3.0 | 5 votes |
SavedFilters = ({ savedFilterData, setShowDelete, filterUtils }) => {
const { t } = useTranslation();
const { classes } = useStyles();
return (
<>
<List
dense
component="div"
disablePadding
className={classes.nested}
>
{savedFilterData.map((savedFilter) => {
return (
<ListItem
key={savedFilter.id}
button
dense
onClick={() =>
filterUtils.setFilterFromChoices(
savedFilter.choices
)
}
>
<ListItemIcon
classes={{
root: classes.listItemIcon,
}}
>
<Checkbox
size="small"
edge="start"
checked={filterUtils.areFiltersAndChoicesIdentical(
savedFilter.choices
)}
tabIndex={-1}
disableRipple
color="primary"
classes={{
root: classes.checkboxRoot,
}}
/>
</ListItemIcon>
<ListItemText primary={savedFilter.name} />
</ListItem>
);
})}
<ListItem dense>
<Box>
<Button
color="primary"
variant="outlined"
onClick={() => setShowDelete(true)}
size="small"
disabled={savedFilterData.length === 0}
>
{t('delete')}
</Button>
</Box>
</ListItem>
</List>
</>
);
}
Example #8
Source File: index.js From fireact with MIT License | 5 votes |
AccountMenu = () => {
const { accountId } = useParams();
const { userData } = useContext(AuthContext);
useEffect(() => {
document.querySelectorAll('.c-sidebar').forEach(element => {
window.coreui.Sidebar._sidebarInterface(element)
});
})
return (
<List>
<Link to={'/account/'+accountId+'/'} style={{textDecoration:'none'}}>
<ListItem button key="Demo App">
<ListItemIcon><DashboardIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">Demo App</Typography>} />
</ListItem>
</Link>
{userData.currentAccount.role === 'admin' &&
<>
<Divider />
<Link to={'/account/'+accountId+'/users'} style={{textDecoration:'none'}}>
<ListItem button key="Users">
<ListItemIcon><PeopleIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">Users</Typography>} />
</ListItem>
</Link>
<Link to={'/account/'+accountId+'/billing'} style={{textDecoration:'none'}}>
<ListItem button key="Billing">
<ListItemIcon><PaymentIcon /></ListItemIcon>
<ListItemText primary={<Typography color="textPrimary">Billing</Typography>} />
</ListItem>
</Link>
</>
}
</List>
)
}
Example #9
Source File: VertOptions.js From react-saas-template with MIT License | 5 votes |
function VertOptions(props) {
const { items, classes, color } = props;
const anchorEl = useRef();
const [isOpen, setIsOpen] = useState(false);
const handleClose = useCallback(() => {
setIsOpen(false);
}, [setIsOpen]);
const handleOpen = useCallback(() => {
setIsOpen(true);
}, [setIsOpen]);
const id = isOpen ? "scroll-playground" : null;
return (
<Fragment>
<IconButton
onClick={handleOpen}
buttonRef={anchorEl}
style={{ color: color ? color : null }}
aria-describedby={id}
aria-label="More Options"
size="large">
<MoreVertIcon style={{ color: color ? color : null }} />
</IconButton>
<Popover
id={id}
open={isOpen}
anchorEl={anchorEl.current}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
transformOrigin={{
vertical: "top",
horizontal: "center",
}}
onClose={handleClose}
disableScrollLock
>
<MenuList dense>
{items.map((item) => (
<MenuItem
key={item.name}
onClick={() => {
handleClose();
item.onClick();
}}
>
<ListItemIcon>{item.icon}</ListItemIcon>
<ListItemText className={classes.listItemtext}>
{item.name}
</ListItemText>
</MenuItem>
))}
</MenuList>
</Popover>
</Fragment>
);
}
Example #10
Source File: NavSection.js From Django-REST-Framework-React-BoilerPlate with MIT License | 5 votes |
ListItemIconStyle = styled(ListItemIcon)({
width: 22,
height: 22,
color: 'inherit',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
})
Example #11
Source File: Grouped.jsx From Edlib with GNU General Public License v3.0 | 4 votes |
Grouped = ({ allH5ps, contentTypes }) => {
const { t } = useTranslation();
const { classes } = useStyles();
const open = useArray();
const categoriesObject = allH5ps.reduce((categories, h5p) => {
let groups = contentAuthorConstants.groups.filter(
(group) => group.contentTypes.indexOf(h5p.value) !== -1
);
if (groups.length === 0) {
groups.push({
translationKey: 'others',
order: null,
});
}
groups.forEach((group) => {
if (!categories[group.translationKey]) {
categories[group.translationKey] = {
translationKey: group.translationKey,
order: group.order,
contentTypes: [],
};
}
categories[group.translationKey].contentTypes.push(h5p);
});
return categories;
}, {});
const categories = Object.values(categoriesObject).sort((a, b) => {
if (a.order === null) {
return 1;
}
if (b.order === null) {
return -1;
}
return a.order - b.order;
});
return (
<List dense component="div" disablePadding className={classes.nested}>
{categories.map((category, index) => (
<React.Fragment key={index}>
<ListItem
button
onClick={() => open.toggle(category.translationKey)}
>
<ListItemText>
<strong>
{_.capitalize(
t(
`content_type_groups.${category.translationKey}`
)
)}
</strong>
</ListItemText>
{open.has(category.translationKey) ? (
<ExpandLess />
) : (
<ExpandMore />
)}
</ListItem>
<Collapse
in={open.has(category.translationKey)}
timeout="auto"
unmountOnExit
>
<List dense component="div" disablePadding>
{category.contentTypes.map((h5p, index) => (
<ListItem
key={index}
button
dense
onClick={() => contentTypes.toggle(h5p)}
>
<ListItemIcon
classes={{
root: classes.listItemIcon,
}}
>
<Checkbox
size="small"
edge="start"
checked={contentTypes.has(h5p)}
tabIndex={-1}
disableRipple
color="primary"
classes={{
root: classes.checkboxRoot,
}}
/>
</ListItemIcon>
<ListItemText
primary={`${h5p.title} (${h5p.filteredCount})`}
/>
</ListItem>
))}
</List>
</Collapse>
</React.Fragment>
))}
</List>
);
}
Example #12
Source File: NavBar.js From react-saas-template with MIT License | 4 votes |
function NavBar(props) {
const { selectedTab, messages, classes, openAddBalanceDialog, theme } = props;
// Will be use to make website more accessible by screen readers
const links = useRef([]);
const [isMobileOpen, setIsMobileOpen] = useState(false);
const [isSideDrawerOpen, setIsSideDrawerOpen] = useState(false);
const isWidthUpSm = useMediaQuery(theme.breakpoints.up("sm"));
const openMobileDrawer = useCallback(() => {
setIsMobileOpen(true);
}, [setIsMobileOpen]);
const closeMobileDrawer = useCallback(() => {
setIsMobileOpen(false);
}, [setIsMobileOpen]);
const openDrawer = useCallback(() => {
setIsSideDrawerOpen(true);
}, [setIsSideDrawerOpen]);
const closeDrawer = useCallback(() => {
setIsSideDrawerOpen(false);
}, [setIsSideDrawerOpen]);
const menuItems = [
{
link: "/c/dashboard",
name: "Dashboard",
onClick: closeMobileDrawer,
icon: {
desktop: (
<DashboardIcon
className={
selectedTab === "Dashboard" ? classes.textPrimary : "text-white"
}
fontSize="small"
/>
),
mobile: <DashboardIcon className="text-white" />,
},
},
{
link: "/c/posts",
name: "Posts",
onClick: closeMobileDrawer,
icon: {
desktop: (
<ImageIcon
className={
selectedTab === "Posts" ? classes.textPrimary : "text-white"
}
fontSize="small"
/>
),
mobile: <ImageIcon className="text-white" />,
},
},
{
link: "/c/subscription",
name: "Subscription",
onClick: closeMobileDrawer,
icon: {
desktop: (
<AccountBalanceIcon
className={
selectedTab === "Subscription"
? classes.textPrimary
: "text-white"
}
fontSize="small"
/>
),
mobile: <AccountBalanceIcon className="text-white" />,
},
},
{
link: "/",
name: "Logout",
icon: {
desktop: (
<PowerSettingsNewIcon className="text-white" fontSize="small" />
),
mobile: <PowerSettingsNewIcon className="text-white" />,
},
},
];
return (
<Fragment>
<AppBar position="sticky" className={classes.appBar}>
<Toolbar className={classes.appBarToolbar}>
<Box display="flex" alignItems="center">
<Hidden smUp>
<Box mr={1}>
<IconButton
aria-label="Open Navigation"
onClick={openMobileDrawer}
color="primary"
size="large"
>
<MenuIcon />
</IconButton>
</Box>
</Hidden>
<Hidden smDown>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="primary"
>
Wa
</Typography>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="secondary"
>
Ver
</Typography>
</Hidden>
</Box>
<Box
display="flex"
justifyContent="flex-end"
alignItems="center"
width="100%"
>
{isWidthUpSm && (
<Box mr={3}>
<Balance
balance={2573}
openAddBalanceDialog={openAddBalanceDialog}
/>
</Box>
)}
<MessagePopperButton messages={messages} />
<ListItem
disableGutters
className={classNames(classes.iconListItem, classes.smBordered)}
>
<Avatar
alt="profile picture"
src={`${process.env.PUBLIC_URL}/images/logged_in/profilePicture.jpg`}
className={classNames(classes.accountAvatar)}
/>
{isWidthUpSm && (
<ListItemText
className={classes.username}
primary={
<Typography color="textPrimary">Username</Typography>
}
/>
)}
</ListItem>
</Box>
<IconButton
onClick={openDrawer}
color="primary"
aria-label="Open Sidedrawer"
size="large"
>
<SupervisorAccountIcon />
</IconButton>
<SideDrawer open={isSideDrawerOpen} onClose={closeDrawer} />
</Toolbar>
</AppBar>
<Hidden smDown>
<Drawer // both drawers can be combined into one for performance
variant="permanent"
classes={{
paper: classes.drawerPaper,
}}
open={false}
>
<List>
{menuItems.map((element, index) => (
<Link
to={element.link}
className={classes.menuLink}
onClick={element.onClick}
key={index}
ref={(node) => {
links.current[index] = node;
}}
>
<Tooltip
title={element.name}
placement="right"
key={element.name}
>
<ListItem
selected={selectedTab === element.name}
button
divider={index !== menuItems.length - 1}
className={classes.permanentDrawerListItem}
onClick={() => {
links.current[index].click();
}}
aria-label={
element.name === "Logout"
? "Logout"
: `Go to ${element.name}`
}
>
<ListItemIcon className={classes.justifyCenter}>
{element.icon.desktop}
</ListItemIcon>
</ListItem>
</Tooltip>
</Link>
))}
</List>
</Drawer>
</Hidden>
<NavigationDrawer
menuItems={menuItems.map((element) => ({
link: element.link,
name: element.name,
icon: element.icon.mobile,
onClick: element.onClick,
}))}
anchor="left"
open={isMobileOpen}
selectedItem={selectedTab}
onClose={closeMobileDrawer}
/>
</Fragment>
);
}
Example #13
Source File: NavigationDrawer.js From react-saas-template with MIT License | 4 votes |
function NavigationDrawer(props) {
const { open, onClose, anchor, classes, menuItems, selectedItem, theme } =
props;
const isWidthUpSm = useMediaQuery(theme.breakpoints.up("sm"));
window.onresize = () => {
if (isWidthUpSm && open) {
onClose();
}
};
return (
<Drawer variant="temporary" open={open} onClose={onClose} anchor={anchor}>
<Toolbar className={classes.headSection}>
<ListItem
style={{
paddingTop: theme.spacing(0),
paddingBottom: theme.spacing(0),
height: "100%",
justifyContent: anchor === "left" ? "flex-start" : "flex-end",
}}
disableGutters
>
<ListItemIcon className={classes.closeIcon}>
<IconButton
onClick={onClose}
aria-label="Close Navigation"
size="large"
>
<CloseIcon color="primary" />
</IconButton>
</ListItemIcon>
</ListItem>
</Toolbar>
<List className={classes.blackList}>
{menuItems.map((element) => {
if (element.link) {
return (
<Link
key={element.name}
to={element.link}
className={classes.noDecoration}
onClick={onClose}
>
<ListItem
button
selected={selectedItem === element.name}
/**
* We disable ripple as it will make a weird animation
* with primary and secondary color
*/
disableRipple
disableTouchRipple
>
<ListItemIcon>{element.icon}</ListItemIcon>
<ListItemText
primary={
<Typography variant="subtitle1" className="text-white">
{element.name}
</Typography>
}
/>
</ListItem>
</Link>
);
}
return (
<ListItem button key={element.name} onClick={element.onClick}>
<ListItemIcon>{element.icon}</ListItemIcon>
<ListItemText
primary={
<Typography variant="subtitle1" className="text-white">
{element.name}
</Typography>
}
/>
</ListItem>
);
})}
</List>
</Drawer>
);
}
Example #14
Source File: Layout.jsx From CRM with Apache License 2.0 | 2 votes |
Layout = (props) => {
const { window } = props;
const [mobileOpen, setMobileOpen] = React.useState(false);
const handleDrawerToggle = () => {
setMobileOpen(!mobileOpen);
};
const sidebarContents = [
{
title: "Contacts",
link: "/admin_dashboard/contacts",
icon: <Phone strokeWidth={1} />,
},
{
title: "Tickets",
link: "/admin_dashboard/tickets",
icon: <Package strokeWidth={1} />,
},
{
title: "Todos",
link: "/admin_dashboard/todos",
icon: <FileText strokeWidth={1} />,
},
{
title: "Email",
link: "/admin_dashboard/emails",
icon: <Inbox strokeWidth={1} />,
},
{
title: "CDA",
link: "/admin_dashboard/cda",
icon: <Book strokeWidth={1} />,
},
];
const drawer = (
<div>
<Toolbar />
<Divider />
<List>
{sidebarContents.map((item, index) => (
<ListItem button key={index} component={NavLink} to={item.link}>
<ListItemIcon>{item.icon}</ListItemIcon>
<ListItemText primary={item.title} />
</ListItem>
))}
</List>
<Divider />
</div>
);
const container =
window !== undefined ? () => window().document.body : undefined;
const [anchorEl, setAnchorEl] = React.useState(null);
const open = Boolean(anchorEl);
const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
const renderMenu = (
<Menu
id="long-menu"
MenuListProps={{
"aria-labelledby": "long-button",
}}
anchorEl={anchorEl}
open={open}
onClose={handleClose}
>
<MenuItem onClick={handleClose}>
<ListItemIcon>
<User width="18px" strokeWidth={1.5} />
</ListItemIcon>
<Typography variant="inherit">Profile</Typography>
</MenuItem>
<MenuItem onClick={handleClose}>
<ListItemIcon>
<LogOut width="18px" strokeWidth={1.5} />
</ListItemIcon>
<Typography variant="inherit">Logout</Typography>
</MenuItem>
</Menu>
);
return (
<section className="wrapper">
<Box sx={{ display: "flex" }}>
<CssBaseline />
<AppBar
position="fixed"
sx={{
// width: { sm: `calc(100% - ${drawerWidth}px)` },
// ml: { sm: `${drawerWidth}px` },
backgroundColor: "#1e1e2f",
backgroundImage: "none",
boxShadow: "none",
borderTop: "2px solid #1d8cf8",
}}
>
<Toolbar>
<IconButton
color="inherit"
aria-label="open drawer"
edge="start"
onClick={handleDrawerToggle}
sx={{ mr: 2, display: { sm: "none" } }}
>
<MenuIcon />
</IconButton>
<Typography variant="h6" noWrap component="div">
Easy CRM
</Typography>
<Box sx={{ flexGrow: 1 }} />
<IconButton
color="inherit"
aria-label="more"
id="long-button"
aria-controls={open ? "long-menu" : undefined}
aria-expanded={open ? "true" : undefined}
aria-haspopup="true"
onClick={handleClick}
>
<MoreVertical />
</IconButton>
{renderMenu}
</Toolbar>
</AppBar>
<Box
component="nav"
sx={{ width: { sm: drawerWidth }, flexShrink: { sm: 0 } }}
aria-label="sidebar"
className="sidebar"
>
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
<Drawer
container={container}
variant="temporary"
open={mobileOpen}
onClose={handleDrawerToggle}
ModalProps={{
keepMounted: true, // Better open performance on mobile.
}}
sx={{
display: { xs: "block", sm: "none" },
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: 230,
border: "none",
// backgroundColor: "transparent",
background: "linear-gradient(0deg, #3358f4, #1d8cf8)",
position: "relative",
},
}}
>
{drawer}
</Drawer>
<Drawer
variant="permanent"
sx={{
display: { xs: "none", sm: "block" },
"& .MuiDrawer-paper": {
boxSizing: "border-box",
width: 230,
border: "none",
backgroundColor: "transparent",
position: "relative",
},
}}
open
>
{drawer}
</Drawer>
</Box>
<Box
component="main"
sx={{
flexGrow: 1,
p: 3,
width: { sm: `calc(100% - ${drawerWidth}px)` },
overflowY: "scroll",
// height: "100vh - 64px",
}}
className="main-panel"
>
<Toolbar />
<Outlet />
</Box>
</Box>
</section>
);
}