Skip to content

Tags Input

Input field for entering multiple tags or values.

React Vue Angular

Press Enter to add tags, Backspace to remove

## Installation
bash
npx @galaxy-stack/nebula-cli add tags-input
bash
npx @galaxy-stack/nebula-cli add tags-input
bash
npx @galaxy-stack/nebula-cli add tags-input
bash
# If you have installed galaxy-design globally
galaxy-design add tags-input

Usage

tsx
import { TagsInput } from '@/components/tags-input'
import { useState } from 'react'

export default function TagsInputDemo() {
  const [tags, setTags] = useState<string[]>(['react', 'vue'])

  return (
    <TagsInput
      value={tags}
      onChange={setTags}
      placeholder="Add tag..."
    />
  )
}
vue
<script setup lang="ts">
import { ref } from 'vue'
import { TagsInput } from '@/components/tags-input'

const tags = ref(['react', 'vue'])
</script>

<template>
  <TagsInput
    v-model="tags"
    placeholder="Add tag..."
  />
</template>
typescript
import { Component } from '@angular/core'
import { TagsInputComponent } from '@/components/tags-input'

@Component({
  selector: 'app-tags-input-demo',
  standalone: true,
  imports: [TagsInputComponent],
  template: `
    <ui-tags-input
      [value]="tags"
      (valueChange)="tags = $event"
      placeholder="Add tag..."
    />
  `
})
export class TagsInputDemo {
  tags = ['react', 'vue']
}

API Reference

Props

PropTypeDefaultDescriptionFrameworks
valuestring[][]Current tag valuesAll
onChange(tags: string[]) => void-Called when tag list changesAll
onTagAdd(tag: string) => void-Called when a tag is addedAll
onTagRemove(tag: string) => void-Called when a tag is removedAll
placeholderstring'Add tag...'Placeholder text for inputAll
classNamestring''CSS class names for tags containerAll
disabledbooleanfalseDisables tag entry and removalAll

Features

  • Add tags by pressing Enter
  • Remove last tag with Backspace
  • Click X button to remove individual tags
  • Duplicate prevention
  • Focus ring styling

Accessibility

  • Proper keyboard navigation
  • Screen reader support for tag removal
  • Focus management

Author

Bùi Trọng Hiếu (kevinbui)

License

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Released under the MIT License.