elastic / eui

Elastic UI Framework 🙌
https://eui.elastic.co/
Other
6.08k stars 829 forks source link

[EuiBadge] Support onClick & href #4530

Open parkiino opened 3 years ago

parkiino commented 3 years ago

Type check fails when you have both an onClick prop and an href prop. Even if you are not using iconOnClick, if you have an href prop, type check requires iconOnClick and iconOnClickAriaLabel.

The EuiBadge type is inferred since type check knows it can't be an anchor because there's an onClick and it can't be a button because there's an anchor, so it must be the last type, which is iconOnClick+iconOnClickAriaLabel.

chandlerprall commented 3 years ago

@cchaos just to confirm, we want EuiBadge to work similarly to EuiButton and support both href & onClick props together?

cchaos commented 3 years ago

Yep, that's fine. I still like our ESLint warning, but we should still allow it for special cases.