diff --git a/src/components/Tags/Tags.tsx b/src/components/Tags/Tags.tsx index 21adca1a..f57ad064 100644 --- a/src/components/Tags/Tags.tsx +++ b/src/components/Tags/Tags.tsx @@ -1,3 +1,4 @@ +import { forwardRef } from 'react'; import classnames from 'classnames'; import { getCommonProps } from '../../utils'; import { px } from '../../utils'; @@ -75,35 +76,39 @@ export const Tag = ({ id, className, onRemove, label }: TagProps) => { * * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-tags--overview) */ -const TagsList = ({ className, children, clearAllLabel = 'Clear All', onClear, ...props }: TagsListProps) => { - const type = 'tags-list'; - const { className: baseClassName, ...commonProps } = getCommonProps(props, 'TagsList'); - const { id } = props; +const TagsList = forwardRef( + ({ className, children, clearAllLabel = 'Clear All', onClear, ...props }, ref) => { + const type = 'tags-list'; + const { className: baseClassName, ...commonProps } = getCommonProps(props, 'TagsList'); + const { id } = props; + return ( +
+ {children} + {Array.isArray(children) && children.length > 0 && ( + + )} +
+ ); + }, +); - return ( -
- {children} - {Array.isArray(children) && children.length > 0 && ( - - )} -
- ); -}; +TagsList.displayName = 'Tags'; export default TagsList;