Tag

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

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

Small Medium Large

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

Small Medium Large

Use the prefix slot to add an icon before the tag label.

Small Medium Large

Use the variant attribute to change the tag’s status indication.

Info Success Warning Danger

Info Success Warning Danger

Info Success Warning Danger

Use the base and prefix parts to apply custom colors to the background, border and icon associated with the tag.

Custom
import '@ods/components/web.tag';

Note: You only need to import a web component once in your code, as it registers itself globally when defined, allowing you to use it anywhere within your application without needing to re-import it each time you want to use the component.

Slots

NameDescription
(default)The tag's content.

Properties

Please note, both DOM properties and HTML attributes are shown in the table below. Unless otherwise specified, the property and attribute names are identical.

Property/AttributeReflectsTypeDefault
variant
'primary' | 'success' | 'neutral' | 'warning' | 'danger''neutral'
size
'small' | 'medium' | 'large''medium'
removable
booleanfalse

Events

React EventDescriptionEvent Detail
ods-removeEmitted when the remove button is activated.--

Parts

NameDescription
baseThe component's base wrapper.
contentThe tag's content.
remove-buttonThe tag's remove button, an `<ods-icon-button>`.
remove-button__baseThe remove button's exported `base` part.
prefixThe tag's prefix slot.

Dependencies

This component automatically imports the following dependencies.

  • ods-icon
  • ods-icon-button

Search