Tag
Small label, optionally clickable.
Import
import '@kittl/ui';
import { Tag } from '@kittl/ui-react';
Usage
<kittl-tag>Label</kittl-tag>
<kittl-tag tag-type="clickable">Clickable Tag</kittl-tag>
<kittl-tag tag-type="clickable" disabled>Disabled</kittl-tag>
import { Tag } from '@kittl/ui-react';
/** Basic Tag usage, rendered live on the docs site. */
export const TagUsage = () => (
<>
<Tag>Label</Tag>
<Tag type="clickable" onTagClick={() => console.log('clicked')}>
Clickable Tag
</Tag>
<Tag type="clickable" disabled>
Disabled
</Tag>
</>
);
Props
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
size | size | 's' | 's' | Tag size |
type | tag-type | 'default' | 'clickable' | 'default' | Interaction mode |
disabled | disabled | boolean | — | Disable the tag |
HTML attribute name
Use tag-type as the HTML attribute name (to avoid conflict with the native type attribute).
Events
| Event | Detail | Description |
|---|---|---|
tag-click | — | Fired when a clickable tag is clicked |
React prop: onTagClick
Accessibility
- When
type="clickable":role="button",tabindex="0" - Keyboard: Enter triggers click