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
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
use hikari_components::*; use hikari_components::prelude::*;
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { ref, type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "eu-west", label: "Europe (West)", meta: "fra1", flag: "🇪🇺" },
{ key: "us-east", label: "United States (East)", meta: "iad1", flag: "🇺🇸" },
{ key: "ap-northeast", label: "Asia Pacific (North-East)", meta: "hnd1", flag: "🇯🇵" },
{ key: "legacy", label: "Legacy cluster", meta: "retired", disabled: true },
];
const column: CSSProperties = { maxWidth: "26rem" };
const regions = ref<readonly string[]>(["eu-west", "us-east"]);
export default () => (
<div style={column}>
<HkTagInput
modelValue={regions.value}
onUpdate:modelValue={(keys: string[]) => {
regions.value = keys;
}}
options={catalog}
label="Deployment regions"
hint="The first region is the primary one."
/>
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let catalog = vec![
TagOption { key: "eu-west".to_string(), label: "Europe (West)".to_string(), meta: Some("fra1".to_string()), flag: Some("🇪🇺".to_string()), ..Default::default() },
TagOption { key: "us-east".to_string(), label: "United States (East)".to_string(), meta: Some("iad1".to_string()), flag: Some("🇺🇸".to_string()), ..Default::default() },
TagOption { key: "ap-northeast".to_string(), label: "Asia Pacific (North-East)".to_string(), meta: Some("hnd1".to_string()), flag: Some("🇯🇵".to_string()), ..Default::default() },
TagOption { key: "legacy".to_string(), label: "Legacy cluster".to_string(), meta: Some("retired".to_string()), disabled: true, ..Default::default() },
];
rsx! {
div { style: "max-width:26rem",
TagInput {
model_value: vec!["eu-west".to_string(), "us-east".to_string()],
options: catalog,
label: Some("Deployment regions".to_string()),
hint: Some("The first region is the primary one.".to_string()),
id: Some("regions".to_string()),
}
}
}
import { ref, type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "eu-west", label: "Europe (West)", meta: "fra1", flag: "🇪🇺" },
{ key: "us-east", label: "United States (East)", meta: "iad1", flag: "🇺🇸" },
{ key: "ap-northeast", label: "Asia Pacific (North-East)", meta: "hnd1", flag: "🇯🇵" },
{ key: "legacy", label: "Legacy cluster", meta: "retired", disabled: true },
];
const column: CSSProperties = { maxWidth: "26rem" };
const regions = ref<readonly string[]>(["eu-west", "us-east"]);
export default () => (
<div style={column}>
<HkTagInput
modelValue={regions.value}
onUpdate:modelValue={(keys: string[]) => {
regions.value = keys;
}}
options={catalog}
label="Deployment regions"
hint="The first region is the primary one."
/>
</div>
);let catalog = vec![
TagOption { key: "eu-west".to_string(), label: "Europe (West)".to_string(), meta: Some("fra1".to_string()), flag: Some("🇪🇺".to_string()), ..Default::default() },
TagOption { key: "us-east".to_string(), label: "United States (East)".to_string(), meta: Some("iad1".to_string()), flag: Some("🇺🇸".to_string()), ..Default::default() },
TagOption { key: "ap-northeast".to_string(), label: "Asia Pacific (North-East)".to_string(), meta: Some("hnd1".to_string()), flag: Some("🇯🇵".to_string()), ..Default::default() },
TagOption { key: "legacy".to_string(), label: "Legacy cluster".to_string(), meta: Some("retired".to_string()), disabled: true, ..Default::default() },
];
rsx! {
div { style: "max-width:26rem",
TagInput {
model_value: vec!["eu-west".to_string(), "us-east".to_string()],
options: catalog,
label: Some("Deployment regions".to_string()),
hint: Some("The first region is the primary one.".to_string()),
id: Some("regions".to_string()),
}
}
}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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { ref, type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "cors", label: "CORS origin", keywords: "http tls" },
{ key: "admin", label: "Admin keyword" },
{ key: "beta", label: "Beta flag" },
];
const column: CSSProperties = { display: "grid", gap: "16px", maxWidth: "26rem" };
const keywords = ref<readonly string[]>(["cors", "beta"]);
export default () => (
<div style={column}>
<HkTagInput
modelValue={keywords.value}
onUpdate:modelValue={(keys: string[]) => {
keywords.value = keys;
}}
options={catalog}
allowCustom
maxTags={3}
label="Request filters"
/>
</div>
);
rsx! {
div { style: "display:grid;gap:16px;max-width:26rem",
TagInput {
model_value: vec!["cors".to_string(), "beta".to_string()],
options: vec![
TagOption { key: "cors".to_string(), label: "CORS origin".to_string(), keywords: Some("http tls".to_string()), ..Default::default() },
TagOption { key: "admin".to_string(), label: "Admin keyword".to_string(), ..Default::default() },
TagOption { key: "beta".to_string(), label: "Beta flag".to_string(), ..Default::default() },
],
allow_custom: true,
max_tags: 3,
label: Some("Request filters".to_string()),
id: Some("filters".to_string()),
}
}
}
import { ref, type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "cors", label: "CORS origin", keywords: "http tls" },
{ key: "admin", label: "Admin keyword" },
{ key: "beta", label: "Beta flag" },
];
const column: CSSProperties = { display: "grid", gap: "16px", maxWidth: "26rem" };
const keywords = ref<readonly string[]>(["cors", "beta"]);
export default () => (
<div style={column}>
<HkTagInput
modelValue={keywords.value}
onUpdate:modelValue={(keys: string[]) => {
keywords.value = keys;
}}
options={catalog}
allowCustom
maxTags={3}
label="Request filters"
/>
</div>
);rsx! {
div { style: "display:grid;gap:16px;max-width:26rem",
TagInput {
model_value: vec!["cors".to_string(), "beta".to_string()],
options: vec![
TagOption { key: "cors".to_string(), label: "CORS origin".to_string(), keywords: Some("http tls".to_string()), ..Default::default() },
TagOption { key: "admin".to_string(), label: "Admin keyword".to_string(), ..Default::default() },
TagOption { key: "beta".to_string(), label: "Beta flag".to_string(), ..Default::default() },
],
allow_custom: true,
max_tags: 3,
label: Some("Request filters".to_string()),
id: Some("filters".to_string()),
}
}
}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".
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "ops", label: "Ops" },
{ key: "billing", label: "Billing" },
];
const column: CSSProperties = { display: "grid", gap: "16px", maxWidth: "24rem" };
export default () => (
<div style={column}>
<HkTagInput modelValue={["ops"]} options={catalog} size="sm" label="Small" />
<HkTagInput modelValue={["ops", "billing"]} options={catalog} size="md" label="Medium" />
<HkTagInput modelValue={["ops"]} options={catalog} size="lg" label="Large" />
<HkTagInput modelValue={["ops"]} options={catalog} disabled label="Disabled" placeholder="No tags" />
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
rsx! {
div { style: "display:grid;gap:16px;max-width:24rem",
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Sm,
label: Some("Small".to_string()),
id: Some("tags-sm".to_string()),
}
TagInput {
model_value: vec!["ops".to_string(), "billing".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Md,
label: Some("Medium".to_string()),
id: Some("tags-md".to_string()),
}
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Lg,
label: Some("Large".to_string()),
id: Some("tags-lg".to_string()),
}
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
disabled: true,
label: Some("Disabled".to_string()),
placeholder: Some("No tags".to_string()),
id: Some("tags-off".to_string()),
}
}
}
import { type CSSProperties } from "vue";
import { HkTagInput, type HkTagOption } from "@celestia-island/hikari";
const catalog: HkTagOption[] = [
{ key: "ops", label: "Ops" },
{ key: "billing", label: "Billing" },
];
const column: CSSProperties = { display: "grid", gap: "16px", maxWidth: "24rem" };
export default () => (
<div style={column}>
<HkTagInput modelValue={["ops"]} options={catalog} size="sm" label="Small" />
<HkTagInput modelValue={["ops", "billing"]} options={catalog} size="md" label="Medium" />
<HkTagInput modelValue={["ops"]} options={catalog} size="lg" label="Large" />
<HkTagInput modelValue={["ops"]} options={catalog} disabled label="Disabled" placeholder="No tags" />
</div>
);rsx! {
div { style: "display:grid;gap:16px;max-width:24rem",
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Sm,
label: Some("Small".to_string()),
id: Some("tags-sm".to_string()),
}
TagInput {
model_value: vec!["ops".to_string(), "billing".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Md,
label: Some("Medium".to_string()),
id: Some("tags-md".to_string()),
}
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
size: TagInputSize::Lg,
label: Some("Large".to_string()),
id: Some("tags-lg".to_string()),
}
TagInput {
model_value: vec!["ops".to_string()],
options: vec![
TagOption { key: "ops".to_string(), label: "Ops".to_string(), ..Default::default() },
TagOption { key: "billing".to_string(), label: "Billing".to_string(), ..Default::default() },
],
disabled: true,
label: Some("Disabled".to_string()),
placeholder: Some("No tags".to_string()),
id: Some("tags-off".to_string()),
}
}
}
API
Vue
Props
Emits
Rust
Props — TagInput
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