Token

Token is a compact representation of an object, and is typically used to show a collection of related metadata.

Ready to use
import {Avatar, Stack, Token} from '@primer/react-brand'

Token is a compact representation of an object, and is typically used to show a collection of related metadata.

Keep Token content short and easy to scan. A single word is ideal. Two short words are acceptable when the category or type needs more context.

Examples

Default

Loading

Variants

Loading

Interactive tokens

When the entire Token should act as a link, render it as an anchor. Use interactive Tokens for secondary navigation, filters, or related metadata links. Do not use Tokens as primary calls to action.

Use as="a" when the whole Token should act as a link.

Loading

Leading visual

Use a leading visual when it helps users scan the Token more quickly. Octicons, logos, and small square avatars work well here. Keep the visual decorative and compact.

Loading

Component props

Token

nametypedefaultrequireddescription
as'span', 'a''span'falseThe HTML element rendered by Token
leadingVisualReactElementundefinedfalseThe leading visual appears before the Token content
variant'default'
'dark-gray'
'accent'
'outline'
'invisible'
'default'falseThe variant variations available in Token
hrefstringundefinedfalseAnchor destination when as="a"
  • Label: For larger non-interactive status and metadata treatments.
  • Link: For inline navigational text.
  • Button: For higher-emphasis actions.