Tag

Compact UI to display a collection of concise information.

When to use

  • When displaying a list of tags.

Examples

Tag basic Usage

default
long text inside the tag

Classname usage

default

Tag in different sizes

sm
lg

AvatarTag Component

U
user
Charlie Chaplin
U
User
Charlie Chaplin
U
user
User with very long long name
U
user
With Start enhancer
U
user
With Start enhancer

AvatarTag uses Tag component internally and accepts all TagProps.

Tag Intent Prop Type

default
warning
error
success
info

Tag Variants Prop Type

solid
light

Tag closeable/non-clickable

default
error
success
warning
info

default
error
success
warning
info

Tag closeable/clickable

neutral
primary
accent
positive
warning
ai

neutral
primary
accent
positive
warning
ai

Tag non-closeable/non-clickable

default
error
success
warning
info

default
error
success
warning
info

Tag non-closeable/clickable

neutral
primary
accent
positive
warning

neutral
primary
accent
positive
warning

API

Tag props

NameTypeDefaultDescription
children
react node
Visible label.
className
string
Classname to apply on root of tag component
closeable
boolean
trueInclude or exclude the "x" button and click action.
intent
'default'| 'warning'| 'error'| 'success'| 'info'| 'ai'
Defines tags look by purpose.
isFocused
boolean
falseIs tag focused.
isHovered
boolean
falseIs tag hovered.
noTooltipOnTruncation
boolean
falseBy default, tooltip will be visible when content gets truncated
onActionClick
function
onClick handler for the action button element.
onActionKeyDown
function
keydown handler for the action button element.
onClick
function
onClick handler for the tag. Passing an onClick handler also makes the tag clickable.
onKeyDown
function
onkeydown handler for the tag.
overrides
custom
Lets you customize all aspects of the component.
size
'sm'| 'lg'
Size of tag.
startEnhancer
function
A component rendered at the start of the tag.
title
string
Text to display in native OS tooltip on long hover.
variant
'light'| 'solid'
Defines tags look. Defaults to light variant.

You can check the implementation of the component for more details.

Tag exports

You can import this module like so:

import {AvatarTag} from 'spaceweb/tag'

It exports the following components or utility functions:

  • AvatarTag
  • StyledAction
  • StyledRoot
  • StyledStartEnhancer
  • StyledText
  • Tag