PersistentToastGroup

PersistentToastGroup

HkPersistentToastGroup is the chrome-bar row of PersistentToast chips: it renders the first maxVisible children in caller order and collapses the rest into a passive "+N" counter. It owns no state and no timer of its own — each chip keeps its detail card and its own life.

  • Reach for it when a bar has room for one or two status chips but the page can carry more conditions at once (three tasks loading, several upstream faults).
  • The overflow counter is passive text: it is not a button and opens nothing. A host that wants the hidden chips reachable puts them somewhere else (a status popover, a detail page) — the group will not do it.
  • One chip, no overflow, is plain PersistentToast; this wrapper only earns its place once the count can exceed the budget.

Import

tsx
1
import { HkPersistentToast, HkPersistentToastGroup } from "@celestia-island/hikari";
rust
1
2
3
use hikari_components::*;          // PersistentToastGroup, PersistentToast, PersistentToastTone, use_portal
                                   // PERSISTENT_TOAST_GROUP_MAX_VISIBLE, persistent_toast_group_split
use hikari_components::prelude::*; // PersistentToastGroupProps, rsx!, VNode

The Vue component is exported as HkPersistentToastGroup as well as HPersistentToastGroup. The Rust form is PersistentToastGroup(PersistentToastGroupProps { … }).

A chip inside the group that carries a detail card panics outside a PortalProvider: the card's open path calls use_portal(), which expect()s the provider's context. The fences here show chips without a card. Give an interactive chip a provider ancestor: inside a real host mounts the provider once at the root PortalProvider once at the root, so any chip below it inherits the context in real code. That provider has no props struct to spell in a fence here (see PortalProvider).

The slice and the counter

maxVisible defaults to 3. The split is the one-line arithmetic: visible = children.slice(0, Math.max(0, props.maxVisible)), extra = children.length - visible.length, and the counter renders only when extra > 0. A budget of 0 hides every chip and counts them all. Hidden children are unmounted, not merely hidden: their hover cards and timers are their own state and die with the vnode, so a chip that re-enters the window starts fresh.

This example is rendered in the browser and needs JavaScript.

Three chips, a budget of two: both cards show the loading chip, the warning chip and +1. The third chip is not in the document — its card could never open, so there is nothing to hover.

What the mirror cannot copy

Rust deltas, declared in the source. Vue takes the default slot's vnodes; a Rust component has no slot, so the chips arrive as items: Vec<Element>. That change is visible in two places: the group cannot reach into a child to read or rewrite it, and an empty item still counts toward the overflow — Vue filters comment vnodes out before slicing, so pass only real chips. The other half of "unmounted" (tearing down a hidden chip's instance) also disappears, because the slice is the whole of the eviction here.

The Rust side also exports the arithmetic as persistent_toast_group_split(total, max_visible) -> (usize, usize) and the default budget as PERSISTENT_TOAST_GROUP_MAX_VISIBLE, so a host that needs the same numbers for its own layout can ask instead of re-deriving them. Vue's default is read from the prop declaration only.

Rust
Loading statsImporting events

Two chips inside the default budget of three: no counter, just the icons and labels. The Rust card is the same still the Vue card renders — the group adds no chrome of its own beyond span.hk-persistent-toast-group.

API

Vue

Props

NameTypeDefaultRequired
maxVisibleNumber as PropType<number>3—

Rust

Props — PersistentToastGroup

PropTypeDefaultDescription
max_visibleusize3How many chips stay visible before the "+N" counter takes over.
itemsVec<Element>[]The chips, in caller order (Vue: the default slot).

Accessibility

  • The group itself carries no role and no live region: it is a layout span. Each chip keeps its own role="status" + aria-live="polite", so a label change on a visible chip still announces once.
  • The "+N" counter is plain text and is not announced as an update — a chip disappearing into the overflow changes the counter silently. If the count matters, put it in the bar's own text or a live region the host owns.
  • Hiding chips removes them from both the accessibility tree and the tab order, because they are unmounted rather than visually clipped.
  • The group adds no tab stop; the only focusable things inside are the interactive chips themselves.

Related components

  • PersistentToast — the chip this row arranges.
  • Toast — the transient corner stack, when the status does not belong in a bar.
  • BlockingToast — the prompt that waits for an answer.