If you answer yes, we store and analyse information that helps us improve the website. You can change your choice at any time at the bottom of the page. More about what we store and why.

We also store necessary information that cannot be opted out of. This makes the website work and keeps it secure.

Skip to main content

What are you looking for?

Try searching for…

Components

Tag

Tag is a label that can be used to categorize items or communicate progress, status, or process. Tags can provide users with a quicker overview of content.

Press Enter to start editing
<span class="ds-tag">New</span>
const Preview = () => {
  return <Tag>New</Tag>;
};

render(<Preview />)

Usage

Apply the class name ds-tag to the element that should be a tag. You can set variant="outline" to add an outline to the tag.

CSS variables and data attributes

Size is controlled with data-size and color with data-color. The component inherits these from the closest parent where they are set.

CSS Variables
NameValue
--dsc-tag-backgroundvar(--ds-color-surface-tinted)
--dsc-tag-background--hovervar(--ds-color-surface-hover)
--dsc-tag-border-colortransparent
--dsc-tag-border-radiusvar(--ds-border-radius-sm)
--dsc-tag-border-stylesolid
--dsc-tag-border-widthvar(--ds-border-width-default)
--dsc-tag-colorvar(--ds-color-text-default)
--dsc-tag-min-heightvar(--ds-size-8)
--dsc-tag-padding0 var(--ds-size-2)
Data Attributes
NameValue
data-variantoutline

React

Tag

asChild
Description

Change the default rendered element for the one passed as a child, merging their props and behavior.

Type
boolean
Default
false
variant
Description

The visual variant of the tag

Type
"default" | "outline"
Default
'default'
NameTypeDefaultDescription
asChildbooleanfalse

Change the default rendered element for the one passed as a child, merging their props and behavior.

variant"default" | "outline"'default'

The visual variant of the tag

Edit this page on github.com (opens in a new tab)