diff --git a/CHANGELOG.md b/CHANGELOG.md index b352718ccdba..75ccf4eb605a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [`master`](https://github.com/elastic/eui/tree/master) -No public interface changes since `13.3.0`. +- Allow `onClick` and `href` props on `ListGroupItem` ([#1933](https://github.com/elastic/eui/pull/1933)) ## [`13.3.0`](https://github.com/elastic/eui/tree/v13.3.0) diff --git a/src/components/list_group/__snapshots__/list_group_item.test.js.snap b/src/components/list_group/__snapshots__/list_group_item.test.js.snap index 26fc39e957d9..3881ae91b0dc 100644 --- a/src/components/list_group/__snapshots__/list_group_item.test.js.snap +++ b/src/components/list_group/__snapshots__/list_group_item.test.js.snap @@ -49,6 +49,22 @@ exports[`EuiListGroupItem props extraAction is rendered 1`] = ` `; +exports[`EuiListGroupItem props href and onClick is rendered 1`] = ` +
  • + + + +
  • +`; + exports[`EuiListGroupItem props href is rendered 1`] = `
  • `; - -exports[`EuiListGroupItem throws an warning if both onClick and href are provided but still renders 1`] = ` -
  • - - - -
  • -`; diff --git a/src/components/list_group/list_group_item.js b/src/components/list_group/list_group_item.js index c24f1e742177..aece24d777d5 100644 --- a/src/components/list_group/list_group_item.js +++ b/src/components/list_group/list_group_item.js @@ -99,17 +99,15 @@ export const EuiListGroupItem = ({ if (href && !isDisabled) { itemContent = ( - + {iconNode} {labelContent} ); - - if (onClick) { - console.warn( - 'Both `href` and `onClick` were passed to EuiListGroupItem but only one can exist. The `href` was used.' - ); - } } else if ((href && isDisabled) || onClick) { itemContent = (