TagInput
Input that creates tags on Enter, with support for a maximum limit, removal and duplicate prevention.
TagInput
Design lines
vue
vue
1<Tabs defaultValue="tuix">2 <TabsList>3 <Tab value="tuix">TUIX</Tab>4 <Tab value="rubik">Rubik</Tab>5 </TabsList>6 <TabPanel value="tuix">7 <TagInput :model-value="['vue']" design="tuix" />8 </TabPanel>9 <TabPanel value="rubik">10 <TagInput :model-value="['vue']" design="rubik" />11 </TabPanel>12</Tabs>Demo
Basic (modelValue)
Binds the current tag list with v-model through modelValue.
vue
1<TagInput v-model="tags" color="success" :max="5" placeholder="Add tag..." />Color (color)
Each row keeps its own tags: adding or removing in one never affects the others.
vue
1<script setup lang="ts">2import { ref } from 'vue'3import { TagInput } from '@dowardev/herdrate-vue'45const tagPrimary = ref<string[]>(['vue'])6const tagSuccess = ref<string[]>(['vue'])7</script>89<template>10 <TagInput v-model="tagPrimary" color="primary" placeholder="Primary" />11 <TagInput v-model="tagSuccess" color="success" placeholder="Success" />12</template>Limit (max)
Caps the number of tags through the max prop (0 disables the limit).
vue
1<TagInput v-model="tagsLimited" :max="5" />Disabled (disabled)
Disables the input and tag interaction through the disabled prop.
locked
vue
1<TagInput v-model="tags" disabled />Props
modelValue
Current list of tags (v-model with string array).
| Type | Default | Required |
|---|---|---|
string[] | [] | ❌ |
color
Semantic color of the tags.
| Type | Default | Required |
|---|---|---|
'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark' | 'primary' | ❌ |
disabled
Disables the input and interaction with the tags.
| Type | Default | Required |
|---|---|---|
boolean | false | ❌ |
placeholder
Placeholder of the text field.
| Type | Default | Required |
|---|---|---|
string | 'Add tag...' | ❌ |
max
Maximum number of allowed tags (0 = no limit).
| Type | Default | Required |
|---|---|---|
number | 0 | ❌ |
design
Design line (or inherit from data-design).
| Type | Default | Required |
|---|---|---|
'tuix' | 'rubik' | — (inherits from data-design) | ❌ |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | string[] | Emitted when a tag is added or removed |
CSS Custom Properties
| Token | Default | Description |
|---|---|---|
--font-mono | "JetBrains Mono", ui-monospace, monospace | Monospace font stack for code-like content (key labels, log lines, chips). |
--accent | from theme (--ctp-latte-mauve / --ctp-mocha-mauve) | Accent color, mapped from the active semantic color. |
--bg | from theme (--ctp-latte-base / --ctp-mocha-base) | Base background of the surface. |
--border | from theme (--ctp-latte-surface0 / --ctp-mocha-surface0) | Outline and divider color for surfaces. |
--text | from theme (--ctp-latte-text / --ctp-mocha-text) | Primary text color used inside the component. |
--cp-ease | cubic-bezier(.4, 0, .2, 1) | Default easing curve for transitions. |
Ver Theming para la convención completa.