diff --git a/CHANGELOG.md b/CHANGELOG.md
index 000012745fb..c92d4718ff4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
- Added support for all `color`s of `EuiPanel` ([#4504](https://github.com/elastic/eui/pull/4504))
- Added `hasBorder` prop to `EuiPanel` ([#4504](https://github.com/elastic/eui/pull/4504))
- Added `labelProps` prop to `EuiRadio`, `EuiSwitch` and `EuiCheckbox` ([#4516](https://github.com/elastic/eui/pull/4516))
+- Added `isDisabled` prop to `EuiAvatar` ([#4549](https://github.com/elastic/eui/pull/4549))
**Bug fixes**
diff --git a/src-docs/src/views/avatar/avatar_initials.js b/src-docs/src/views/avatar/avatar_initials.js
index ebf11560512..6c92d30d662 100644
--- a/src-docs/src/views/avatar/avatar_initials.js
+++ b/src-docs/src/views/avatar/avatar_initials.js
@@ -33,5 +33,34 @@ export default () => (
initials="En"
initialsLength={2}
/>
+
+
+ Disabled
+
+
+
+
+
+
+
);
diff --git a/src/components/avatar/__snapshots__/avatar.test.tsx.snap b/src/components/avatar/__snapshots__/avatar.test.tsx.snap
index c0cbcba6190..78d9b025151 100644
--- a/src/components/avatar/__snapshots__/avatar.test.tsx.snap
+++ b/src/components/avatar/__snapshots__/avatar.test.tsx.snap
@@ -86,6 +86,21 @@ exports[`EuiAvatar props initialsLength is rendered 1`] = `
`;
+exports[`EuiAvatar props isDisabled is rendered 1`] = `
+
+
+ n
+
+
+`;
+
exports[`EuiAvatar props size l is rendered 1`] = `
{
expect(component).toMatchSnapshot();
});
});
+
+ describe('isDisabled', () => {
+ it('is rendered', () => {
+ const component = render();
+
+ expect(component).toMatchSnapshot();
+ });
+ });
});
test('should throw error if color is not a hex', () => {
diff --git a/src/components/avatar/avatar.tsx b/src/components/avatar/avatar.tsx
index 90aeb49be78..6e00ca2ed4b 100644
--- a/src/components/avatar/avatar.tsx
+++ b/src/components/avatar/avatar.tsx
@@ -73,6 +73,11 @@ export type EuiAvatarProps = Omit, 'color'> &
type?: EuiAvatarType;
imageUrl?: string;
size?: EuiAvatarSize;
+
+ /**
+ * Grays out the avatar to simulate being disabled
+ */
+ isDisabled?: boolean;
};
export const EuiAvatar: FunctionComponent = ({
@@ -84,6 +89,7 @@ export const EuiAvatar: FunctionComponent = ({
name,
size = 'm',
type = 'user',
+ isDisabled = false,
...rest
}) => {
const visColors = euiPaletteColorBlindBehindText();
@@ -92,6 +98,9 @@ export const EuiAvatar: FunctionComponent = ({
'euiAvatar',
sizeToClassNameMap[size],
typeToClassNameMap[type],
+ {
+ 'euiAvatar-isDisabled': isDisabled,
+ },
className
);