diff --git a/packages/react/src/components/Chips/Chips.tsx b/packages/react/src/components/Chips/Chips.tsx index 3510a2c9..c1ce852e 100644 --- a/packages/react/src/components/Chips/Chips.tsx +++ b/packages/react/src/components/Chips/Chips.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from 'react'; +import { Children, Fragment, useRef, useState } from 'react'; import { ChipsProps } from './Chips.types'; @@ -63,15 +63,21 @@ export const Chips = (inProps: ChipsProps) => { if ( totalWidth + - columnGap + chipWidth + (!open && index < chips.length - 1 && lineCount >= maxLines ? columnGap + buttonWidth : 0) >= containerWidth ) { lineCount += 1; - totalWidth = chipWidth; + totalWidth = chipWidth + columnGap; + + if ( + totalWidth + (!open && index < chips.length - 1 && lineCount >= maxLines ? buttonWidth : 0) >= + containerWidth + ) { + lineCount += 1; + } } else { - totalWidth += columnGap + chipWidth; + totalWidth += chipWidth + columnGap; } if (!open && lineCount > maxLines) { @@ -91,21 +97,42 @@ export const Chips = (inProps: ChipsProps) => { onResize(); }, [open]); + const button = ( + + ); + return (