docs/components/input/TagInput

TagInput

Multi-value tag/token input.

import { TagInput } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#More Examples

With Default Tags

<TagInput
  defaultValue={[ 'react', 'solidjs', 'typescript' ]}
  placeholder="Add more tags..."
/>

With Suggestions

<TagInput
  suggestions={[
      'react',      'vue',
      'angular',    'solidjs',
      'svelte',     'typescript',
      'javascript', 'css',
      'html'
    ]}
  placeholder="Type to see suggestions..."
/>

#Props

PropTypeDefaultDescription
valuestring[]Controlled tags array
defaultValuestring[]Default tags (uncontrolled)
onChange(tags: string[]) => voidCallback when tags change
suggestionsstring[]Autocomplete suggestions
placeholderstringInput placeholder text
maxTagsnumberMaximum number of tags allowed
allowDuplicatesbooleanAllow duplicate tags
disabledbooleanDisable all interaction
labelstringLabel text
classstringAdditional CSS classes
styleJSX.CSSPropertiesCustom styles
unstyledbooleanRemove sk-* styling classes

#Design Tokens

This component reads the following CSS custom properties. Override them globally or per-instance to restyle it — see the CSS Variables guide.

  • --sk-accent
  • --sk-bg-secondary
  • --sk-bg-tertiary
  • --sk-border
  • --sk-focus-color
  • --sk-font-size-sm
  • --sk-radius-md
  • --sk-radius-sm
  • --sk-space-sm
  • --sk-space-xs
  • --sk-tag-input-bg
  • --sk-tag-input-border
  • --sk-tag-input-radius
  • --sk-tag-input-tag-bg
  • --sk-tag-input-tag-color
  • --sk-text-muted
  • --sk-text-primary