Skip to content

Commit 1ddb167

Browse files
authored
Merge pull request #7577 from kristelvdakker/pr/changeable-DashboardMenuItem-icon
Changeable icon for DashboardMenuItem
2 parents 79cf3cf + 20f3b83 commit 1ddb167

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/ra-ui-materialui/src/layout/DashboardMenuItem.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
import * as React from 'react';
1+
import React, { ReactElement } from 'react';
22
import PropTypes from 'prop-types';
33
import DashboardIcon from '@mui/icons-material/Dashboard';
44
import { useTranslate, useBasename } from 'ra-core';
55

66
import { MenuItemLink } from './MenuItemLink';
77

88
export const DashboardMenuItem = (props: DashboardMenuItemProps) => {
9-
const { locale, ...rest } = props;
9+
const { locale, leftIcon = <DashboardIcon />, ...rest } = props;
1010
const translate = useTranslate();
1111
const basename = useBasename();
1212
return (
1313
<MenuItemLink
1414
to={`${basename}/`}
1515
primaryText={translate('ra.page.dashboard')}
16-
leftIcon={<DashboardIcon />}
16+
leftIcon={leftIcon}
1717
{...rest}
1818
/>
1919
);
2020
};
2121

2222
export interface DashboardMenuItemProps {
23+
leftIcon?: ReactElement;
2324
locale?: string;
2425
onClick?: () => void;
2526
dense?: boolean;
@@ -30,6 +31,7 @@ export interface DashboardMenuItemProps {
3031
}
3132

3233
DashboardMenuItem.propTypes = {
34+
leftIcon: PropTypes.element,
3335
locale: PropTypes.string,
3436
onClick: PropTypes.func,
3537
dense: PropTypes.bool,

0 commit comments

Comments
 (0)