# Tag Group URL: /react/components/tag-group Source: https://github.com/daangn/seed-design/blob/dev/docs/content/react/components/tag-group.mdx An information summary component that displays multiple attributes, states, and metadata at a glance by listing icon and text tags horizontally. 사용 가능 버전: @seed-design/react@1.0.6, @seed-design/css@1.0.6 ## Preview ```tsx import { IconLocationpinFill } from "@karrotmarket/react-monochrome-icon"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupPreview() { return ( } label="500m" /> ); } ``` ## Installation - npm: npx @seed-design/cli@latest add ui:tag-group - pnpm: pnpm dlx @seed-design/cli@latest add ui:tag-group - yarn: yarn dlx @seed-design/cli@latest add ui:tag-group - bun: bun x @seed-design/cli@latest add ui:tag-group ## Props ### `TagGroupRoot` ### `TagGroupItem` ## Examples ### Sizes ```tsx import { VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupSizes() { return ( ); } ``` ### Weights ```tsx import { VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupWeights() { return ( ); } ``` ### Tones ```tsx import { VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupTones() { return ( ); } ``` ### With Icons ```tsx import { IconLocationpinFill, IconMegaphoneFill } from "@karrotmarket/react-monochrome-icon"; import { VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupWithIcons() { return ( } /> } label="서초4동" /> ); } ``` ### Customizing `TagGroupItem` The `size`, `tone`, and `weight` specified on `TagGroupRoot` can be overridden on `TagGroupItem`. If needed, you can customize the internal elements of `TagGroupItem` by directly using [compound components](/react/components/concepts/snippet#compound-components). ```tsx import { IconCheckmarkCircleFill, IconHeartFill, IconHorizline2VerticalChatbubbleRectangularRightFill, IconStarFill, } from "@karrotmarket/react-monochrome-icon"; import { Icon, VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; import { TagGroup as SeedTagGroup } from "@seed-design/react"; export default function TagGroupCustomizingItem() { return ( {/* You can use the compound components to customize the items */} } color="fg.brand" /> 4.5 } label="인증됨" /> } label="10" /> } label="3" /> ); } ``` ### Customizing Separators You can change the separator by specifying `separator` on `TagGroupRoot`. Screen readers do not read the specified separator between each tag item. Avoid using semantic information as a separator. ```tsx import { VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; export default function TagGroupCustomizingSeparators() { return ( ); } ``` ### Wrapping Behavior By default, `TagGroupRoot` wraps when it exceeds the container width. When you specify the `truncate` prop on `TagGroupRoot`, `TagGroupRoot` is maintained on one line, and if it exceeds the container width, ellipsis may occur on all `TagGroupItem` labels by default. To prevent a specific item from shrinking while using the `truncate` prop, specify `flexShrink={0}` on that `TagGroupItem`. You can adjust the priority of shrinking when exceeding container width by specifying `flexShrink={number}` on `TagGroupItem`. ```tsx import { IconBellFill, IconLocationpinFill } from "@karrotmarket/react-monochrome-icon"; import { Flex, Text, VStack } from "@seed-design/react"; import { TagGroupRoot, TagGroupItem } from "seed-design/ui/tag-group"; import type { PropsWithChildren, ReactNode } from "react"; export default function TagGroupWrappingBehavior() { return ( } label="부산광역시 해운대구" /> } label="123 456 789 012 345" /> } label="부산광역시 해운대구" /> } label="123 456 789 012 345" /> } label="부산광역시 해운대구" /> } label="123 456 789 012 345" /> } flexShrink={1} label="부산광역시 해운대구" /> } label="123 456 789 012 345" /> ); } function Wrapper({ title, children }: PropsWithChildren<{ title: ReactNode }>) { return ( {title} {children} ); } ```