Skip to content

TkxTag

import { TkxTag } from 'tekivex-ui';
Default tags
reacttypescriptwcagopen-source
<TkxTag>react</TkxTag>
<TkxTag>typescript</TkxTag>
<TkxTag>wcag</TkxTag>
Variants
defaultprimarysuccesswarningdangerinfo
<TkxTag variant="default">default</TkxTag>
<TkxTag variant="primary">primary</TkxTag>
<TkxTag variant="success">success</TkxTag>
<TkxTag variant="warning">warning</TkxTag>
<TkxTag variant="danger">danger</TkxTag>
<TkxTag variant="info">info</TkxTag>
Sizes
smmdlg
<TkxTag size="sm" variant="primary">sm</TkxTag>
<TkxTag size="md" variant="primary">md</TkxTag>
<TkxTag size="lg" variant="primary">lg</TkxTag>
Closable — click × to remove
reacttypescripttekivex-uiwcag
<TkxTag icon={<CheckIcon />} variant="success">verified</TkxTag>
const [tags, setTags] = useState(['react', 'typescript', 'tekivex-ui']);
{tags.map((t) => (
<TkxTag
key={t}
closable
onClose={() => setTags((xs) => xs.filter((x) => x !== t))}
>
{t}
</TkxTag>
))}

The close button has localised aria-label from the active locale (e.g. “Close” / “بند کریں”).

import { TkxTagInput } from 'tekivex-ui';
const [tags, setTags] = useState<string[]>(['react', 'a11y']);
<TkxTagInput
label="Topics"
tags={tags}
onChange={setTags}
placeholder="Add topic and press Enter"
suggestions={['react', 'typescript', 'a11y', 'i18n']}
/>

Press Enter or Comma to commit a tag, Backspace in an empty input to remove the last tag. Suggestions auto-complete as the user types.

TkxTag (without close button) uses no hooks — safe for Next.js Server Components. TkxTagInput is interactive and requires 'use client'.

  • Tags render as <span> by default (decorative). Tags with closable render the inner pill as <span> and the close button as <button>
  • Close button has localised aria-label
  • TkxTagInput field has full label/hint/error wiring
  • Tag chips inside the input are keyboard-removable via Backspace
PropTypeRequiredDescription
variantstringOne of the 6 named variants.
size'sm' | 'md' | 'lg'Defaults to md.
closablebooleanRender close button.
onClose() => voidRequired when closable.
iconReactNodeLeading icon.
PropTypeRequiredDescription
tagsstring[]yesControlled tag list.
onChange(tags: string[]) => voidyesList change.
suggestionsstring[]Optional autocomplete.
maxTagsnumberSoft cap.
allowDuplicatesbooleanDefaults to false.

src/components/TkxTag.tsx