diff --git a/changelogs/upcoming/7724.md b/changelogs/upcoming/7724.md new file mode 100644 index 00000000000..3cd548e4385 --- /dev/null +++ b/changelogs/upcoming/7724.md @@ -0,0 +1,3 @@ +**Bug fixes** + +- Fixed `EuiFlexGroup` and `EuiFlexItem` `ref` prop typing to support refs of the same type as the passed `component` type and allow `displayName` to be defined for easy component naming when using component wrappers like `styled()` diff --git a/src/components/flex/flex_group.tsx b/src/components/flex/flex_group.tsx index 41311af37a5..c7bb866486b 100644 --- a/src/components/flex/flex_group.tsx +++ b/src/components/flex/flex_group.tsx @@ -12,7 +12,7 @@ import React, { ElementType, ForwardedRef, forwardRef, - FunctionComponent, + PropsWithChildren, Ref, } from 'react'; import classNames from 'classnames'; @@ -54,32 +54,34 @@ type FlexGroupDirection = (typeof DIRECTIONS)[number]; type ComponentPropType = ElementType; export type EuiFlexGroupProps = - ComponentPropsWithoutRef & { - alignItems?: FlexGroupAlignItems; - /** - * Customize the component type that is rendered. - * - * It can be any valid React component type like a tag name string - * such as `'div'` or `'span'`, a React component (a function, a class, - * or an exotic component like `memo()`). - * - * `` accepts and forwards all extra props to the custom - * component. - * - * @example - * // Renders a