Skip to main content

Tag

Small label, optionally clickable.

Preview
Loading preview…

Import

// Web Component
import '@kittl/ui';

// React
import { Tag } from '@kittl/ui-react';

Usage

Web Component

<kittl-tag>Label</kittl-tag>
<kittl-tag tag-type="clickable">Clickable Tag</kittl-tag>
<kittl-tag tag-type="clickable" disabled>Disabled</kittl-tag>

React

<Tag>Label</Tag>
<Tag type="clickable" onTagClick={() => console.log('clicked')}>Clickable Tag</Tag>
<Tag type="clickable" disabled>Disabled</Tag>

Props

PropertyTypeDefaultDescription
size's''s'Tag size
type'default' | 'clickable''default'Interaction mode
disabledbooleanfalseDisable the tag
HTML attribute name

Use tag-type as the HTML attribute name (to avoid conflict with the native type attribute).

Events

EventDetailDescription
tag-clickFired when a clickable tag is clicked

React prop: onTagClick

Accessibility

  • When type="clickable": role="button", tabindex="0"
  • Keyboard: Enter triggers click