Skip to content

Tags Input

Create, navigate, and remove free-form tokens from one text field.

Usage

Skills

Create and remove free-form skill tags without losing input focus.

Create and remove free-form skill tags without losing input focus.

VueDOMAccessibility

Press Enter or comma to add a tag.

Limited

Enforce the configured item or visible-notification limit without losing existing values.

Enforce the configured item or visible-notification limit without losing existing values.

VueDOMAccessibility

Press Enter or comma to add a tag.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

VueDOMAccessibility

Press Enter or comma to add a tag.

API

Vue package: @sectile/vue/tags-input

Components
  • TagsInputRoot
  • TagsInputItem
  • TagsInputItemText
  • TagsInputItemDelete
  • TagsInputInput
  • TagsInputClear

Props

TagsInputRootProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

defaultInputValue

Initial uncontrolled text shown by the editable input.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

form

ID of the native form associated with the control.

inputValue

Controlled text currently shown by the editable input.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

name

Name used for native form submission.

policies

Behavior policies that customize validation, movement, or selection.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

TagsInputItemProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

index

Zero-based position of this part in its parent collection.

TagsInputPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

Slots

TagsInputRootSlotProps

disabled

Whether interaction is unavailable.

inputValue

Current editable input text.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

TagsInputItemSlotProps

disabled

Whether interaction is unavailable.

index

Zero-based position in the parent collection.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

Events

TagsInputRoot

update:inputValue

Emitted when editable input text changes.

update:modelValue

Emitted when the component requests a new controlled value.

Other types

TagsInputValueChangeHandler

ts
type TagsInputValueChangeHandler = (value: readonly string[]) => void

TagsInputInputValueChangeHandler

ts
type TagsInputInputValueChangeHandler = (value: string) => void

Parts

Shared scope: [data-scope="tags-input"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
item[data-part="item"]Represents one selectable or actionable item.
item-text[data-part="item-text"]Renders the item label independently from its controls.
item-delete[data-part="item-delete"]Removes its owning item.
input[data-part="input"]Accepts the editable value or draft.
clear[data-part="clear"]Clears the current value or collection.

Keyboard interaction

KeyBehavior
Enter / CommaCommit the current input as a tag.
Arrow Left / Arrow RightMove between the input and existing tags.
Backspace / DeleteMove to or remove the current tag according to cursor state.

Accessibility

The labeled group keeps its text input native and names every removable tag action.

Released under the MIT License.