Tag
A filter or a chosen value, optionally removable.
Example
EUR USD GBP High volatility
<script lang="ts">
import { Tag } from '@onlywin/ui-svelte';
let currencies = $state(['EUR', 'USD', 'GBP']);
</script>
<div class="example-row">
{#each currencies as currency (currency)}
<Tag
label={currency}
onRemove={() =>
(currencies = currencies.filter((item) => item !== currency))}
/>
{/each}
<Tag label="High volatility" icon="zap" />
</div>Usage
Do
- Use it for applied filters and chosen values.
Don’t
- Do not use it for status; use Badge.
Accessibility
- The remove button is named “Remove …”.
Keyboard
| Keys | Action |
|---|---|
Enter, Space | Activate |
Tab, Shift+Tab | Move focus in and out |
Props
The same props in both frameworks. In React, class is className, events are camelCase (onClick),
content passed as Svelte snippets is a ReactNode prop, every bindable value has a default… twin for uncontrolled use,
and elementRef reaches the DOM element.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | TUiIconName | — | |
label
*required | string | — | |
onRemove | () => void | — | Shows a remove button. |