--- title: Tag description: "`Tag` is a component used to categorize or organize items using keywords that describe them." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/tag/tag.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/tag - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-tag--basic --- ```tsx Tag ``` ## Usage ```tsx import { Tag } from "@yamada-ui/react" ``` ```tsx import { Tag } from "@/components/ui" ``` ```tsx import { Tag } from "@workspaces/ui" ``` ```tsx ``` ### Change Variants ```tsx {(variant) => ( {variant} )} ``` ### Change Size ```tsx {(size) => ( {size} )} ``` ### Change Color Scheme ```tsx {(colorScheme) => ( {colorScheme} )} ``` ### Use with Icon ```tsx }>startIcon }>endIcon ``` ### Use Close Button ```tsx const onClose = () => { // Handle close action console.log("Tag closed") } return Tag ``` ### Disable Close Button ```tsx {}}> Tag ``` ## Props | Prop | Default | Type | Description | | ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | `"md"` | `"lg" \| "md" \| "sm"` | The size of the component. | | `variant` | `"subtle"` | `"outline" \| "plain" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. | | `closeButtonProps` | - | `TagCloseButtonProps` | Props for tag close button element. | | `contentProps` | - | `TagContentProps` | Props for content element. | | `disabled` | `false` | `boolean` | If `true`, the tag is disabled. | | `endIcon` | - | `ReactNode` | Icon to be displayed to the end of the tag. | | `iconProps` | - | `HTMLStyledProps<"span">` | Props for icon element. | | `onClose` | - | `MouseEventHandler` | Function to be executed when the close button is clicked. | | `startIcon` | - | `ReactNode` | Icon to be displayed to the start of the tag. | ## Accessibility Currently, this section is being updated due to the migration of v2.