diff --git a/src/components/List/ListIcon.tsx b/src/components/List/ListIcon.tsx
index f1c7194c43..3d14e4a01b 100644
--- a/src/components/List/ListIcon.tsx
+++ b/src/components/List/ListIcon.tsx
@@ -19,6 +19,10 @@ export type Props = {
* @optional
*/
theme?: ThemeProp;
+ /**
+ * Size of the icon.
+ */
+ size?: number;
};
const ICON_SIZE = 24;
@@ -34,7 +38,7 @@ const ICON_SIZE = 24;
* const MyComponent = () => (
* <>
*
- *
+ *
*
* >
* );
@@ -47,15 +51,17 @@ const ListIcon = ({
color: iconColor,
style,
theme: themeOverrides,
+ size,
}: Props) => {
const theme = useInternalTheme(themeOverrides);
+ const iconSize = size ? size : ICON_SIZE;
return (
-
+
);
};
diff --git a/src/components/__tests__/ListItem.test.tsx b/src/components/__tests__/ListItem.test.tsx
index 036697f9ec..1b427355d0 100644
--- a/src/components/__tests__/ListItem.test.tsx
+++ b/src/components/__tests__/ListItem.test.tsx
@@ -159,3 +159,30 @@ it('renders list item with custom content style', () => {
expect(getByTestId('list-item-content')).toHaveStyle(styles.content);
});
+
+it('renders list item with custom icon size with left and right items', () => {
+ const tree = render(
+ GG}
+ right={() => }
+ />
+ ).toJSON();
+
+ expect(tree).toMatchSnapshot();
+});
+
+it('renders list item on left with a icon that has a custom size', () => {
+ const tree = render(
+ }
+ />
+ ).toJSON();
+
+ expect(tree).toMatchSnapshot();
+});
diff --git a/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap b/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
index 514fc61c78..f31e4e65f0 100644
--- a/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
+++ b/src/components/__tests__/__snapshots__/ListItem.test.tsx.snap
@@ -1,5 +1,194 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`renders list item on left with a icon that has a custom size 1`] = `
+
+
+
+
+
+
+
+
+
+ First Item
+
+
+ Item description
+
+
+
+
+`;
+
exports[`renders list item with custom description 1`] = `
`;
+exports[`renders list item with custom icon size with left and right items 1`] = `
+
+
+
+ GG
+
+
+
+ First Item
+
+
+ Item description
+
+
+
+
+
+
+
+
+
+`;
+
exports[`renders list item with custom title and description styles 1`] = `