Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

Tag

Tag is used for items that need to be labeled, categorized, or organized using keywords that describe them.

Import

Usage

EDITABLE EXAMPLE

Variants

Use the variant prop to change the visual style of the Tag. You can set the value to solid, outline.

EDITABLE EXAMPLE

Colors

Use the variantColor prop to change the color scheme of the Tag. variantColor can be any color key that exist in the theme.colors.

EDITABLE EXAMPLE

Sizes

Use the size prop to change the size of the Tag. You can set the value to sm, md, or lg.

EDITABLE EXAMPLE

States

EDITABLE EXAMPLE

Add and edit tag

EDITABLE EXAMPLE

With input

  • For duplicated entries, put both entries invalid, and hover the token to display error message.
  • When paste with text with delimiter, automatically convert to tags. Default delimiter: ,, ;
EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
disabledbooleanIf true, the tag will be disabled. This sets aria-disabled=true and you can style this state by passing the _disabled prop.
isInvalidbooleanIf true, the tag will indicate an error. You can style this state by passing the _invalid prop.
isClosablebooleanIf true, a close button will appear on the right side.
onClosefunctionA callback called when the close button is clicked.
sizestring'md'The size of the tag component. One of: 'sm', 'md', 'lg'
variantstring'solid'The variant style of the tag component. One of: 'solid', 'outline'
variantColorstring'gray'The color scheme of the tag variant. It must be a color key defined in theme.colors.