TagDotRow

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

tsx
1
import { HkTagDotRow, type HkTagDot } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // TagDotRow, HkTagDot, EventHandler
use hikari_components::prelude::*; // rsx!, VNode

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.

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.

API

Vue

Props

NameTypeDefaultRequired
tagsArray as PropType<HkTagDot[]>—✓
labelStringundefined—

Emits

EventPayload
toggle—

Rust

Props — TagDotRow

PropTypeDefaultDescription
tagsVec<HkTagDot>[]The tags in render order (Vue: tags, required there; the Rust default is the empty strip, which renders the group shell only).
labelOption<String>NoneAccessible name for the whole group (Vue: label; absent → no aria-label attribute, exactly like Vue's undefined).
on_toggleOption<EventHandler<String>>NoneA dot was pressed; carries the tag key (Vue: the toggle emit).

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.