TagInput

TagInput

HkTagInput is the tag editor field: the selected tags live inside the field as closable chips, and one searchable catalog panel toggles membership. The value is an ordered array of keys — order is host state, adds append, removes splice in place, and reordering writes the same order back.

  • A single amount in canonical decimal text is HkMoneyInput; a token budget with a unit is HkTokenInput.
  • A fill template of {{ token }} placeholders is HkTemplateField — chips there are a rendering of a string, not an array of keys.

Import

tsx
1
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // TagInput, TagOption, TagInputSize
use hikari_components::prelude::*; // rsx!, VNode, EventHandler

The component owns no selected state: add / remove fire with the key, update:modelValue with the full next array, and the host writes the prop back.

Catalog and panel

options is the catalog the panel lists — every option stays listed with a check glyph when selected, so "is this tag used" is readable in one pass. Rows are group-strict: the selected options first, in the host's modelValue order, then the unselected options in catalog order. Toggling never closes the panel, and a query filters within the two groups without re-sorting them. A key the catalog does not carry renders its raw key as the chip's label, so custom tags survive edits of the catalog.

Europe (West)United States (East)

The first region is the primary one.

The Rust mirror renders the panel in place as the field's last child; Vue teleports it into the shared popup surface (a popout on desktop, a bottom sheet on a phone), and the host owns outside dismissal and stacking.

Free-text tags and capacity

With allowCustom the typed query offers a trailing "Use …" row, so the field can also create a value. maxTags is a capacity cap: at the cap every add affordance goes inert while the chips' × still removes — a field that is full can always be emptied.

CORS originBeta flag

Sizes

size picks the field's height — sm, md (the default), lg — and the chip scales with it: sm keeps the small chip, every other step uses the medium chip. disabled removes the inline input entirely, because a disabled control must not be focusable, and renders the placeholder as static text; the box then carries the caption itself with role="group".

Ops
OpsBilling
Ops
OpsNo tags

API

Vue

Props

NameTypeDefaultRequired
modelValueArray as PropType<readonly string[]>() => [] as readonly string[]—
optionsArray as PropType<readonly HkTagOption[]>() => [] as readonly HkTagOption[]—
allowCustomBooleanfalse—
labelStringundefined—
placeholderStringundefined—
hintStringundefined—
disabledBooleanfalse—
size<code>String as PropType<"sm" | "md" | "lg"></code>"md"—
maxTagsNumberundefined—
searchPlaceholderStringundefined—
emptyTextStringundefined—

Emits

EventPayload
update:modelValuestring[]
addstring
removestring
update:openboolean

Rust

Props — TagInput

PropTypeDefaultDescription
model_valueVec<String>[]Selected keys, IN HOST ORDER (order is meaningful to hosts; add appends, remove splices).
optionsVec<TagOption>[]The catalog the panel lists.
allow_customboolfalseOffer the trailing "Use “<query>”" row (free-text tags).
labelOption<String>NoneField caption; also names the panel and the control.
placeholderOption<String>NoneShown inside the field while no tag & query — the inline input's placeholder.
hintOption<String>NoneMuted helper line under the field.
disabledboolfalse—
sizeTagInputSizeTagInputSize::Md—
max_tagsu320Capacity cap; 0 means unlimited.
search_placeholderOption<String>NoneSearch field placeholder; falls back to t("hikari::tagInput.search", "Search").
empty_textOption<String>None"No matches" row text; falls back to t("hikari::tagInput.empty", "No matches").
idOption<String>NoneElement id the caption's for points at, and the seed of the listbox / row / custom stop ids (Vue generates one with useId; tairitsu has no analogue, so nothing is emitted when this is None).
listbox_idOption<String>NoneExplicit listbox id; derived as {id}-listbox when omitted.
openboolfalsePanel visibility (Vue: the local open).
queryString""The inline query (Vue: the local query).
active_indexi32-1The keyboard cursor: an index into the stops, -1 = nothing active (Vue: the local activeIndex).
onupdate_model_valueOption<EventHandler<Vec<String>>>NoneVue: update:modelValue — the full next array.
onaddOption<EventHandler<String>>NoneVue: the add emit (fires before update:modelValue).
onremoveOption<EventHandler<String>>NoneVue: the remove emit (fires before update:modelValue).
onupdate_openOption<EventHandler<bool>>NoneVue: the open emit (every open/close edge).
onqueryOption<EventHandler<String>>NoneThe inline query's writer — the Rust-side stand-in for Vue's local query ref writes (row filtering, "Use …" consumption).
onactiveOption<EventHandler<i32>>NoneThe cursor's writer — the Rust-side stand-in for Vue's local activeIndex writes.

Accessibility

  • The inline input is a combobox: role="combobox", aria-expanded, aria-controls (the listbox id) and aria-autocomplete="list"; rows are role="option" with aria-selected, and the active row is published as aria-activedescendant so focus never leaves the field.
  • ArrowDown / ArrowUp walk the visible rows and the custom row (always the last stop), wrapping at both ends; Enter activates the active row, and with nothing active it adds the first row the query can still add — a selected row is never a blind Enter target, so Enter cannot remove the tag the user is looking at.
  • Backspace on an empty query removes the last tag; Escape folds the panel once and never discards a committed tag.
  • Alt+ArrowUp / Alt+ArrowDown moves the active selected row one slot inside the selected group — the keyboard half of reordering, with hard stops at the group's edges.
  • The chevron is a real button named by the field's title (the label, else the localized "Tags"), and each chip's × names the tag it removes.

Related components