export const title = "Tag components" export const description = "Free and open-source React tag components built for modern applications and websites. These tags are built using React Aria and styled with Tailwind CSS." export const links = { github: "https://github.com/untitleduico/react/tree/main/components/base/tags", rac: "https://react-spectrum.adobe.com/react-aria/TagGroup.html" } import * as Demos from "@/components/base/tags/tags.demo.tsx"; ## Installation You can add this tags component using our CLI or manually: ```bash npx untitledui@latest add tags ``` Copy the files below into your project: Great! Now you can start using the tags components in your project by just copy/pasting our examples below. ## Tags examples Below are examples and variations of this tags component: ### Sizes Our tags component comes with three predefined sizes: `sm`, `md`, and `lg`. You can set the size using the `size` prop on the `TagGroup` component, which will apply to all tags within that group. ### Close X Tags can be dismissible by using the `onRemove` prop on the `TagGroup` component or the `onClose` prop on individual `Tag` components. This will add a remove button to the tag that, when clicked, will trigger the callback function with the key of the tag that was removed. ### Count Tags can display a count next to the tag by passing a number to the `count` prop on the `Tag` component. This is useful when you want to display the number of items associated with the tag. ### Checkbox You can make the tags selectable by passing either `"single"` or `"multiple"` to the `selectionMode` prop on the `TagGroup` component. This will allow users to select one or multiple tags at once. ### Checkbox close X If you'd like to make selectable tags dismissible, you can pass the `onRemove` prop to the `TagGroup` component. This will add a remove button to the tags that, when clicked, will trigger the callback function with the key of the tag that was removed. ### Checkbox count Selectable tags can also display a count next to the tag, just like non-selectable tags, by passing a number to the `count` prop on the `Tag` component. This is useful when you want to display the number of items associated with the tag.