GhostTagsInput reference
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed GhostTagsInput for entering and removing free-form strings in native forms.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
defaultValue | readonly string[] | — | No | Initial uncontrolled tags and reset baseline. |
delimiters | readonly (',' | ';')[] | — | No | Optional typed and pasted separators. |
disabled | boolean | — | No | Disables editing, focus and submission. |
invalid | boolean | — | No | Consumer-owned invalid state. |
messages | Partial<GhostTagsInputMessages> | — | No | Localized button, announcement and validation text. |
modelValue | readonly string[] | — | No | Controlled committed tags. |
name | string | — | No | Repeated native form field name. |
readonly | boolean | — | No | Prevents edits while preserving focus and submission. |
required | boolean | — | No | Requires a committed tag while editable. |
Emits
None declared.
Models
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | readonly string[] | Fresh proposal for the committed tag sequence. |
Slots
| Name | Description |
|---|---|
tag | Formats tag text while the component retains its remove control. |
Slot props: tag
| Name | Type | Description |
|---|---|---|
value | string | Normalized tag string. |
Exposed members
| Name | Type | Description |
|---|---|---|
element | HTMLInputElement | null | Native text input after mount. |
focus | () => void | Focuses the native entry. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Widget container. |
data-part | list | List of committed tags. |
data-part | tag | A committed tag. |
data-part | remove | Native remove button. |
data-part | input | Native text input. |
data-part | status | Persistent polite status region. |
data-state | disabled | The field is disabled. |
data-state | readonly | The field is read-only. |
data-state | invalid | The consumer marked the field invalid. |
CSS variables
None declared.
Accessibility
Role: textbox. APG pattern: https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex.
Required ARIA attributes: none.
Keyboard
| Key | Action | Automated browser test |
|---|---|---|
Enter | Commit a nonempty draft or activate a focused remove button. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Space | Activate a focused remove button. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Backspace | From an empty draft focus the last remove button, or remove the focused tag. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Delete | Remove the focused tag. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
ArrowLeft | Move along the tags or back to the entry, reversed in RTL. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
ArrowRight | Move along the tags or back to the entry, reversed in RTL. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Home | Focus the first remove button from a remove button. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
End | Focus the text entry from a remove button. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Tab | Enter through the text entry or leave the widget. | TagsInput navigates and removes tags with real focus @cross-browser (@ghostvue/themes) |
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Passed | Every declared key maps to a Chromium browser test that CI runs and requires to pass on every commit. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
tags-input/project-labels
Save project labels
Add and remove labels, submit committed tags, and reset the form.
project-labels.vue
vue
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostField,
GhostFieldControl,
GhostFieldDescription,
GhostFieldLabel,
GhostTagsInput,
} from '@ghostvue/themes'
const initialLabels = ['frontend']
const labels = ref<string[]>([...initialLabels])
const saved = ref<string[] | null>(null)
function save(event: SubmitEvent): void {
if (!(event.target instanceof HTMLFormElement)) return
saved.value = new FormData(event.target).getAll('labels').map(String)
}
</script>
<template>
<form class="project-labels" @submit.prevent="save">
<GhostField required>
<GhostFieldLabel>Project labels</GhostFieldLabel>
<GhostFieldDescription>
Press Enter to add a label. Press Backspace on the empty entry to focus
the last label's remove button.
</GhostFieldDescription>
<GhostFieldControl v-slot="field">
<GhostTagsInput
v-bind="field"
v-model="labels"
:default-value="initialLabels"
name="labels"
placeholder="Add a label"
/>
</GhostFieldControl>
</GhostField>
<div class="project-label-actions">
<GhostButton type="submit">Save project</GhostButton>
<GhostButton type="reset">Reset labels</GhostButton>
</div>
<p v-if="saved">Saved labels: {{ saved.join(', ') }}</p>
</form>
</template>
<style scoped>
.project-labels,
.project-label-actions {
display: flex;
gap: var(--ghost-space-gap-sm);
}
.project-labels {
flex-direction: column;
inline-size: min(100%, 28rem);
}
.project-label-actions {
flex-wrap: wrap;
}
</style>
tags-input/read-only
Show imported labels
Display submitted tags in a read-only field.
- frontend
- triage
read-only.vue
vue
<script setup lang="ts">
import { useId } from 'vue'
import { GhostTagsInput } from '@ghostvue/themes'
const id = useId()
const labels: readonly string[] = ['frontend', 'triage']
</script>
<template>
<label :for="id">Imported labels</label>
<GhostTagsInput :id="id" :model-value="labels" readonly name="labels" />
</template>