Tag

Component for categorize content

A <Tag> is a content component. This component can be used to categorize content. They can represent keywords or people, and are grouped to describe an item or a search request.

Usage

Import

To import the component you just have to use this code below.

import { Tag } from '@marigold/components';

Appearance

Sorry! There are currently no variants and sizes available.

Group props

PropertyTypeDefaultDescription
labelstringnoneSet a label for the select.
requiredbooleanfalseSet the select required.
widthstring | numberfullSets the width of the field. You can see allowed tokens here: https://tailwindcss.com/docs/width
allowsRemovingbooleanfalseDisplays a remove button on each tag.
onRemove(key: Key) => anynoneHandler that is called when the remove button is pressed.
renderEmptyState(props: TagListRenderProps) => ReactNodenoneProvides content to display when there are no items in the tag list.

Examples

Tags with a label

In this example we have the <Tag> component that has been given the label.

Categories
News
Travel
Gaming
Shopping

Removable tags

In this example, the <Tag> component receives tags from a dynamic collection and can remove these tags.

Thor
Iron Man
Black Panther
Groot