Skip to main content
Since Shoelace 2.0 Code stable Pattern stable Figma ready


<sl-tag> | SlTag

Tags are used as labels to organize things or to indicate a selection.


Basic Tag

Blue Green Gray Yellow Red Teal Fuchsia Purple
<sl-tag variant="blue">Blue</sl-tag>
<sl-tag variant="green">Green</sl-tag>
<sl-tag variant="gray">Gray</sl-tag>
<sl-tag variant="yellow">Yellow</sl-tag>
<sl-tag variant="red">Red</sl-tag>
<sl-tag variant="teal">Teal</sl-tag>
<sl-tag variant="fuchsia">Fuchsia</sl-tag>
<sl-tag variant="purple">Purple</sl-tag>
sl-tag variant="blue" Blue
sl-tag variant="green" Green
sl-tag variant="gray" Gray
sl-tag variant="yellow" Yellow
sl-tag variant="red" Red
sl-tag variant="teal" Teal
sl-tag variant="fuchsia" Fuchsia
sl-tag variant="purple" Purple
import { SlTag } from '@teamshares/shoelace/dist/react';

const App = () => (
    <SlTag variant="blue">Blue</SlTag>
    <SlTag variant="green">Green</SlTag>
    <SlTag variant="gray">Gray</SlTag>
    <SlTag variant="yellow">Yellow</SlTag>
    <SlTag variant="red">Red</SlTag>
    <SlTag variant="teal">Teal</SlTag>
    <SlTag variant="fuchsia">Fuchsia</SlTag>
    <SlTag variant="purple">Purple</SlTag>


Use the size attribute to change a tag’s size.

Small Medium Large
<sl-tag size="small">Small</sl-tag>
<sl-tag size="medium">Medium</sl-tag>
<sl-tag size="large">Large</sl-tag>
sl-tag size="small" Small
sl-tag size="medium" Medium
sl-tag size="large" Large
import { SlTag } from '@teamshares/shoelace/dist/react';

const App = () => (
    <SlTag size="small">Small</SlTag>
    <SlTag size="medium">Medium</SlTag>
    <SlTag size="large">Large</SlTag>

Semantic variants

A selection of tag colors also map to semantic variants: primary (blue), success (green), neutral (gray), warning (yellow), danger (red).

Primary Success Neutral Warning Danger
<sl-tag variant="primary">Primary</sl-tag>
<sl-tag variant="success">Success</sl-tag>
<sl-tag variant="neutral">Neutral</sl-tag>
<sl-tag variant="warning">Warning</sl-tag>
<sl-tag variant="danger">Danger</sl-tag>
sl-tag variant="primary" Primary
sl-tag variant="success" Success
sl-tag variant="neutral" Neutral
sl-tag variant="warning" Warning
sl-tag variant="danger" Danger
import SlTag from '@teamshares/shoelace/dist/react/tag';

const App = () => (
    <SlTag variant="primary">Primary</SlTag>
    <SlTag variant="success">Success</SlTag>
    <SlTag variant="neutral">Neutral</SlTag>
    <SlTag variant="warning">Warning</SlTag>
    <SlTag variant="danger">Danger</SlTag>


Use the pill attribute to give tags rounded edges. This variant is very similar to the pill button. Use only when there’s little risk of it being confused with a button.

Small Medium Large
<sl-tag size="small" pill>Small</sl-tag>
<sl-tag size="medium" pill>Medium</sl-tag>
<sl-tag size="large" pill>Large</sl-tag>
sl-tag size="small" pill="true" Small
sl-tag size="medium" pill="true" Medium
sl-tag size="large" pill="true" Large
import SlTag from '@teamshares/shoelace/dist/react/tag';

const App = () => (
    <SlTag size="small" pill>
    <SlTag size="medium" pill>
    <SlTag size="large" pill>


Use the removable attribute to add a remove button to the tag.

Small Medium Large
<div class="tags-removable">
  <sl-tag size="small" removable>Small</sl-tag>
  <sl-tag size="medium" removable>Medium</sl-tag>
  <sl-tag size="large" removable>Large</sl-tag>

  const div = document.querySelector('.tags-removable');

  div.addEventListener('sl-remove', event => {
    const tag =; = '0';
    setTimeout(() => ( = '1'), 2000);

  .tags-removable sl-tag {
    transition: var(--sl-transition-medium) opacity;
  sl-tag size="small" removable="true" Small
  sl-tag size="medium" removable="true" Medium
  sl-tag size="large" removable="true" Large

  const div = document.querySelector(.tags-removable);

  div.addEventListener(sl-remove, event => {
    const tag =; = 0;
    setTimeout(() => ( = 1), 2000);

  .tags-removable sl-tag {
    transition: var(--sl-transition-medium) opacity;
import SlTag from '@teamshares/shoelace/dist/react/tag';

const css = `
  .tags-removable sl-tag {
    transition: var(--sl-transition-medium) opacity;

const App = () => {
  function handleRemove(event) {
    const tag =; = '0';
    setTimeout(() => ( = '1'), 2000);

  return (
      <div className="tags-removable">
        <SlTag size="small" removable onSlRemove={handleRemove}>

        <SlTag size="medium" removable onSlRemove={handleRemove}>

        <SlTag size="large" removable onSlRemove={handleRemove}>


Usage Guidelines

Tag Basics

  • Tags can be removed (for example, when they are being used to indicate a filter selection), but they aren’t otherwise interactive
  • Don’t use tags as buttons

When to Use a Tag

  • Use a tag to label or organize items
  • Use a tag to show that a certain category of items has been selected (e.g. a search filter)

When to Use a Different Component

  • Use a badge instead if you need to show counts
  • Use a button instead if you need a clickable element that initiates an action


If you’re using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

Script Import Bundler React

To import this component from the CDN using a script tag:

<script type="module" src=""></script>

To import this component from the CDN using a JavaScript import:

import '';

To import this component using a bundler:

import '@shoelace-style/shoelace/dist/components/tag/tag.js';

To import this component as a React component:

import SlTag from '@shoelace-style/shoelace/dist/react/tag';


Name Description
(default) The tag’s content.

Learn more about using slots.


Name Description Reflects Type Default
variant The tag’s theme variant. 'blue' | 'green' | 'gray' | 'yellow' | 'red' | 'teal' | 'fuchsia' | 'purple' | 'primary' | 'success' | 'neutral' | 'warning' | 'danger' 'gray'
size The tag’s size. 'small' | 'medium' | 'large' 'medium'
pill Draws a pill-style tag with rounded edges. boolean false
removable Makes the tag removable and shows a remove button. boolean false
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.


Name React Event Description Event Detail
sl-remove onSlRemove Emitted when the remove button is activated. -

Learn more about events.


Name Description
base The component’s base wrapper.
content The tag’s content.
remove-button The tag’s remove button, an <sl-icon-button>.
remove-button__base The remove button’s exported base part.

Learn more about customizing CSS parts.


This component automatically imports the following dependencies.

  • <sl-icon>
  • <sl-icon-button>