Skip to content

Commit f25bada

Browse files
authored
RHCLOUD-25154 Show 4 labels - if we have more than 4, wrap at 3 to allow the "X more" to take the 4th place (#157)
1 parent 8aeaec9 commit f25bada

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/Tags/Tags.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {FunctionComponent, PropsWithChildren} from "react";
1+
import {Children, FunctionComponent, PropsWithChildren} from "react";
22
import {LabelGroup} from "@patternfly/react-core";
33

44
export const Tags: FunctionComponent<PropsWithChildren> = ({children}) => {
5-
return <LabelGroup>
5+
const numLabels = Children.toArray(children).length <= 4 ? 4 : 3;
6+
return <LabelGroup numLabels={numLabels}>
67
{children}
78
</LabelGroup>;
89
};

0 commit comments

Comments
 (0)