Tag

Display an item's category, attributes, or status as a short label.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-tag color="purple" size="medium">Design</sy-tag>

Usage guide

#

Display categories, filters, or status with short labels. Use Button for actions and Badge for counts.

Selectable tags

Use selectable to allow toggling, as with a filter.

Removable tags

Use removable to remove selected values from a list. Restrict interaction with disabled or readonly.

Feature examples

#

Choose a feature from 12 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Disabled

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Manual Close

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Readonly

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Removable

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Rounded

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Selectable

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Size

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Color

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Events · Removed

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

Events · Selected

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

Usage examples · Remove tags programmatically

Call setRemove() to remove a tag. Handle the removal event to update the app's selection list as well.

View code
HTML
<sy-tag removable id="sample">Design</sy-tag>
<div class="demo-actions"
  style="display:flex;flex-wrap:wrap;gap:8px;margin-top:16px"
>
  <sy-button id="action-0" size="small">Remove tag</sy-button>
</div>
<output id="demo-result" aria-live="polite"></output>

<script type="module">
  const describeResult = value => JSON.stringify(value, (_key, item) => {
    if (item instanceof File) return {
      name: item.name,
      size: item.size,
      type: item.type
    };
    if (item instanceof Element) return `<${item.localName}>`;
    return item;
  }) ?? 'Done';
  const actionTarget0 = document.querySelector("#sample");
  document.querySelector('#action-0').addEventListener('click', async () => {
    const result = await actionTarget0.setRemove();
    document.querySelector('#demo-result').textContent = describeResult(result);
  });
</script>

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-tag>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseBlock user interaction and keyboard focus.
booleanfalseDisplay the current value while preventing edits.
booleanfalseShow the tag removal button.
booleanfalseUse rounded corners.
booleanfalseAllow tag selection events.
'small' | 'medium' | 'large''medium'Component size.
TagColor'gray'Color applied to the component. Check the type for supported values.
booleanfalseEmit only a removal request. After confirmation, call setRemove(true).

Events

EventDetailDescription
CustomEvent<{ tag: HTMLSyTagElement }>Emitted when the user selects an item.
CustomEvent<{ tag: HTMLSyTagElement; isManualRemove: boolean }>Emitted when a selected item is removed.

Methods

MethodReturnsDescription
Promise<void>Programmatically remove the tag. `isForce=true` bypasses the `manualClose` opt-out so the tag is removed even when manualClose was set (use this from your confirmation handler).

Slots

SlotDescription
Component body or child items.