Tag

A tag represents a label, category, keyword, or filter, and can be used for various groupings. If you need multiple tags, consider using the TagGroup component.

Anatomy

Composed Components

A Tag uses the following components:

Usage

Sizes

A tag can vary in size.

Disabled

A tag can be disabled using the isDisabled prop.

Variants

A tag can vary in style using the variant prop.

Invalid

A tag can be set as invalid using the isInvalid prop.

Loading

A tag can have a loading state using the isLoading prop.

Avatar

A tag can contain an avatar.

Icons

A tag can contain an icon or an icon list.

Count

A tag can contain a count using the Badge component.

A tag can be a link by using the href prop on the Tag component. Tags with an href are not selectable.

A tag can be rendered as a react router link when using the href prop and setting the navigate prop on the HopperProvider.

Props

isInvalid?

Whether the tag is invalid or not.

isLoading?

Whether the tag is loading or not.

size?

The size of the tag.

Defaults to md.
variant?

The visual style of the Tag.

Defaults to neutral.
clearButtonProps?

The props of the ClearButton.

spinnerProps?

The props of the Spinner.

style?

The inline style for the element. A function may be provided to compute the style based on component state.

id?

A unique id for the tag.

textValue?

A string representation of the tags's contents, used for accessibility. Required if children is not a plain text string.

isDisabled?

Whether the tag is disabled.

children?

The children of the component. A function may be provided to alter the children based on component state.

className?

The CSS className for the element. A function may be provided to compute the class based on component state.

href?

A URL to link to. See MDN.

hrefLang?

Hints at the human language of the linked URL. SeeMDN.

target?

The target window for the link. See MDN.

rel?

The relationship between the linked resource and the current page. See MDN.

download?

Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN.

ping?

A space-separated list of URLs to ping when the link is followed. See MDN.

referrerPolicy?

How much of the referrer to send when following the link. See MDN.

routerOptions?

Options for the configured client side router.

Migration Notes

Coming from Orbiter, you should be aware of the following changes:

  • A dot is not supported
  • fluid is not supported.
  • variant values are now neutral | subdued | progress | positive | caution | negative | option1 | option2 | option3 | option4 | option5 | option6 and not solid | outline.
  • validationState is not supported. Use isInvalid instead.