TagDotRow
HkTagDotRow is a horizontal strip of toggleable coloured dots: one dot per tag, the caption beneath it, one press toggles — the Finder tag picker as a control. Tags are domain-free { key, color, label } triples: the host owns the vocabulary and its translations, the row owns only the geometry and the states. It speaks the unified menu-item spec, so the strip keeps menu rhythm inside HkMenu header/footer slots, HkMenuPanel or a popover, and grows with that sheet's tokens inside a mobile sheet.
- A press only emits toggle with the tag key — it never closes a surrounding menu, so several tags can be flipped in one visit. The host decides what the toggle means.
- A tag that is applied carries data-active, aria-pressed="true" and a soft ring of its own colour; an unapplied one recedes to 40% opacity rather than disappearing.
- When the tag list is long, searchable, or must be created inline, a strip of dots is the wrong control — reach for a tag picker with its own search field. A single, read-only label on a piece of content is Tag.
Import
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
use hikari_components::*; use hikari_components::prelude::*;
Tags and their states
Each entry of tags carries a stable key (the value toggle hands back), a color (any CSS colour — hex, rgb(), a var() reference; it is written verbatim into the dot's --hk-tag-color), an optional label and the two flags active / disabled. A dot without a label renders the disc alone; a disabled dot is dimmed through the native disabled attribute and never toggles.
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
const tags: HkTagDot[] = [
{ key: "red", color: "#ef4444", label: "Red", active: true },
{ key: "amber", color: "#f59e0b", label: "Amber" },
{ key: "green", color: "#22c55e", label: "Green" },
{ key: "blue", color: "#3b82f6", label: "Blue", disabled: true },
{ key: "violet", color: "var(--hk-color-primary, #8b5cf6)" },
];
export default () => <HkTagDotRow tags={tags} label="Tags" />;
rsx! {
TagDotRow {
label: Some("Tags".to_string()),
tags: vec![
HkTagDot { key: "red".to_string(), color: "#ef4444".to_string(), label: Some("Red".to_string()), active: true, ..Default::default() },
HkTagDot { key: "amber".to_string(), color: "#f59e0b".to_string(), label: Some("Amber".to_string()), ..Default::default() },
HkTagDot { key: "green".to_string(), color: "#22c55e".to_string(), label: Some("Green".to_string()), ..Default::default() },
HkTagDot { key: "blue".to_string(), color: "#3b82f6".to_string(), label: Some("Blue".to_string()), disabled: true, ..Default::default() },
HkTagDot::new("violet", "var(--hk-color-primary, #8b5cf6)"),
],
}
}
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
const tags: HkTagDot[] = [
{ key: "red", color: "#ef4444", label: "Red", active: true },
{ key: "amber", color: "#f59e0b", label: "Amber" },
{ key: "green", color: "#22c55e", label: "Green" },
{ key: "blue", color: "#3b82f6", label: "Blue", disabled: true },
{ key: "violet", color: "var(--hk-color-primary, #8b5cf6)" },
];
export default () => <HkTagDotRow tags={tags} label="Tags" />;rsx! {
TagDotRow {
label: Some("Tags".to_string()),
tags: vec![
HkTagDot { key: "red".to_string(), color: "#ef4444".to_string(), label: Some("Red".to_string()), active: true, ..Default::default() },
HkTagDot { key: "amber".to_string(), color: "#f59e0b".to_string(), label: Some("Amber".to_string()), ..Default::default() },
HkTagDot { key: "green".to_string(), color: "#22c55e".to_string(), label: Some("Green".to_string()), ..Default::default() },
HkTagDot { key: "blue".to_string(), color: "#3b82f6".to_string(), label: Some("Blue".to_string()), disabled: true, ..Default::default() },
HkTagDot::new("violet", "var(--hk-color-primary, #8b5cf6)"),
],
}
}The Vue strip below is live: pressing a dot flips its active flag in local state, so the applied ring and the receded discs move with your presses. The Rust fence above is the same strip as a still — the snapshot shows one applied tag, two live ones and one disabled one, and nothing moves in it until the host re-renders with new active flags.
Toggling
toggle fires with the tag's key — once per press, on live dots only. The row keeps no state of its own: it re-renders from the tags you pass back, so a host that drops the event renders a strip that never changes. In the Vue example the pressed key is flipped in a local array; the Rust mirror takes a handler and renders the same still strip, because the gate runs without a browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { ref } from "vue";
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
const palette: HkTagDot[] = [
{ key: "urgent", color: "#ef4444", label: "Urgent" },
{ key: "review", color: "#f59e0b", label: "Review" },
{ key: "shipped", color: "#22c55e", label: "Shipped" },
];
const applied = ref<string[]>([]);
const onToggle = (key: string) => {
applied.value = applied.value.includes(key)
? applied.value.filter((entry) => entry !== key)
: [...applied.value, key];
};
export default () => (
<HkTagDotRow
label="Tags"
tags={palette.map((tag) => ({ ...tag, active: applied.value.includes(tag.key) }))}
onToggle={onToggle}
/>
);
rsx! {
TagDotRow {
label: Some("Tags".to_string()),
tags: vec![
HkTagDot { key: "urgent".to_string(), color: "#ef4444".to_string(), label: Some("Urgent".to_string()), active: true, ..Default::default() },
HkTagDot { key: "review".to_string(), color: "#f59e0b".to_string(), label: Some("Review".to_string()), ..Default::default() },
HkTagDot { key: "shipped".to_string(), color: "#22c55e".to_string(), label: Some("Shipped".to_string()), ..Default::default() },
],
on_toggle: Some(EventHandler::new(|_key: String| {})),
}
}
import { ref } from "vue";
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
const palette: HkTagDot[] = [
{ key: "urgent", color: "#ef4444", label: "Urgent" },
{ key: "review", color: "#f59e0b", label: "Review" },
{ key: "shipped", color: "#22c55e", label: "Shipped" },
];
const applied = ref<string[]>([]);
const onToggle = (key: string) => {
applied.value = applied.value.includes(key)
? applied.value.filter((entry) => entry !== key)
: [...applied.value, key];
};
export default () => (
<HkTagDotRow
label="Tags"
tags={palette.map((tag) => ({ ...tag, active: applied.value.includes(tag.key) }))}
onToggle={onToggle}
/>
);rsx! {
TagDotRow {
label: Some("Tags".to_string()),
tags: vec![
HkTagDot { key: "urgent".to_string(), color: "#ef4444".to_string(), label: Some("Urgent".to_string()), active: true, ..Default::default() },
HkTagDot { key: "review".to_string(), color: "#f59e0b".to_string(), label: Some("Review".to_string()), ..Default::default() },
HkTagDot { key: "shipped".to_string(), color: "#22c55e".to_string(), label: Some("Shipped".to_string()), ..Default::default() },
],
on_toggle: Some(EventHandler::new(|_key: String| {})),
}
}
API
Vue
Props
Emits
Rust
Props — TagDotRow
Accessibility
- The root is a div with role="group"; label becomes its aria-label. Without it the group has no name of its own — the individual buttons still do.
- Every dot is a real <button type="button"> whose accessible name is its label, or its key when the tag has no caption. The colour is never the only channel: an applied dot is also aria-pressed="true".
- aria-pressed is always present (never omitted), so a screen reader announces both the on and the off state, unlike the presence-only data-active marker the sheet uses for the ring.
- A disabled tag carries the native disabled attribute, so it is skipped by the Tab order and announced as unavailable instead of silently ignoring the press.
- The native title is a deliberate split: Vue omits it on purpose (the caption span already shows the label, and aria-label covers the dot-only case), while the Rust mirror emits title={label} whenever a caption is present — so the pointer tooltip only exists there.
Related components
- Tag — a single read-only label for a piece of content.
- HkIconChip — a decorative leading glyph, when the mark is an icon rather than a colour.
- HkStatusPill — a compact state readout that is not a control.