PersistentToast
HkPersistentToast is the persistent status chip for chrome bars: a tone icon (or a spinner) plus a label that truncates rather than wraps, an optional ✕ beside it, and — when a detail slot exists — a rich card that opens below the chip on hover or focus and can be pinned by a click. It never auto-dismisses: the host mounts it while a condition holds (a load in flight, an upstream outage) and unmounts it when the condition clears.
- Reach for it when the status belongs to the bar rather than to the page content — a title-bar loading chip, a status-strip fault indicator — and the detail deserves more than a tooltip.
- A transient message that should vanish on its own is Toast; a question the flow waits on is BlockingToast; a row of these chips with a "+N" overflow is PersistentToastGroup.
- Without a detail slot the chip is a plain span — status text with an icon, nothing to hover, nothing to focus.
Import
;
from "@celestia-island/hikari";
use *; // PersistentToast, PersistentToastTone, use_portal, PersistentToastComponent,
// persistent_toast_card_style, persistent_toast_wrap_style,
// persistent_toast_is_escape
use *; // PersistentToastProps, rsx!, VNode, EventHandler
The Vue component is exported under two names, the deprecated HPersistentToast and HkPersistentToast — import the Hk spelling. The Rust form is PersistentToast(PersistentToastProps { … }).
Outside a fence a chip is called directly — PersistentToast(PersistentToastProps { … }). Inside an rsx! block PersistentToast { … } compiles only when no detail is supplied: a card is opened when a pointer reaches the chip, and that path calls use_portal(), which expect()s a PortalProvider above the chip. A fence with no provider therefore fails at runtime with called Option::unwrap() on a None value (the panic site is use_context::<PortalContext>().expect("PortalContext not found")).
Tones, the label and the ✕
Vue declares five tones; Rust declares four — loading renders the sheet's CSS spinner, warning / error the alert triangle and info the information glyph. The label truncates and never wraps — the chip is chrome, and a long text must not reflow a title bar. iconOnly drops the label span entirely and moves the label to the chip's accessible name, for narrow bars. dismissible renders the ✕ as a sibling button of the chip, never a child (a button inside a button is dead markup) and emits dismiss.
The same four chips in both cards: a spinner, two information glyphs, an alert triangle — and an ✕ on the two dismissible ones. Press a ✕ in the TSX card and nothing happens to the chip: dismissal is the host's decision (dismiss tells it the user asked) and the docs page has no host.
The detail card: hover, pin, Escape
With a detail slot the chip becomes a button. Hovering it for openDelay (150 ms) or focusing it opens the card anchored below the chip, end-aligned; moving the pointer onto the card cancels the close timer, leaving it re-arms closeGrace (250 ms). A click pins the card: a pinned card ignores hover-out and only closes on its own Escape, a click on the chip, or an outside click. The wrap carries role="status" + aria-live="polite", so a label change announces without stealing focus — the property a title-bar loading chip relies on.
Both cards show the closed face — the chip with its ✕ — because the card's open state is interaction, not markup: hover or click the TSX chip to see the card, and that card renders from the detail slot. The Rust card keeps its detail in the same document; a snapshot cannot open it.
Rust deltas, declared in the source. The mirror positions the card with CSS instead of a layout read: the wrap is position: relative and the card is position: absolute; top: calc(100% + 6px); inset-inline-end: 0, so the end-aligned 6 px gap survives without getBoundingClientRect, and the 8 px viewport clamp plus the resize listener are gone. The card stays inside the chip's wrap instead of teleporting to the overlay root, which nests a div in the wrap's span. There is no document-level listener seam, so a pinned card closes on a chip click, Escape while the chip is focused, or the chip's focus-out — not on an outside click. The card keeps Vue's hii-dropdown-content class but not the glass surface it names (that sheet is Vue-side), so it paints with this sheet's geometry only. And the chip glyph cannot carry aria-hidden the way the lucide svg does.
Rust gaps. rsx! rows that only set .to_string()/enum fields (the chips above and below) build; a row that also passes detail: compiles, but its card is unreachable unless a PortalProvider sits above the chip. PersistentToastTone has no Success variant — Vue's tone="success" (a check glyph and the hk-persistent-toast--success sheet rule) has no Rust twin, so a success chip is drawn with Info there. Interaction state lives in a module registry keyed by instance_key (falling back to tone|label), because a per-render signal would reset the very state that triggered the render. Two chips in one bar with the same tone and label share their open/pinned state, and a chip whose label changes while its card is open loses that open state — pass instance_key when that can happen. PersistentToast also has no icon_only counterpart: iconOnly is a Vue-only prop.
Two chips with identical tone and label, kept apart by instance_key — without it a hover on the first would open both cards. Vue has no such seam because each chip owns its own component instance.
API
Vue
Props
| Name | Type | Default | Required |
|---|---|---|---|
| tone | String as PropType<PersistentToastTone> | "info" | — |
| label | String | "" | — |
| detailLabel | String | "" | — |
| dismissible | Boolean | false | — |
| openDelay | Number | 150 | — |
| closeGrace | Number | 250 | — |
| iconOnly | Boolean | false | — |
Emits
| Event | Payload |
|---|---|
| dismiss | — |
Rust
Props — PersistentToast
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | PersistentToastTone | PersistentToastTone::Info | Chip tone: loading renders the spinner, the rest a static glyph. |
| label | String | "" | Text beside the icon (truncates, never wraps). |
| detail_label | String | "" | aria-label of the detail card (Vue: detailLabel). |
| dismissible | bool | false | Render the ✕ affordance beside the chip and fire Self::on_dismiss. |
| open_delay | u32 | 150 | Hover delay before the card opens (ms). |
| close_grace | u32 | 250 | Grace period before the card closes after a hover-out (ms). |
| detail | Option<Element> | None | The card content (Vue: the detail slot). |
| on_dismiss | Option<EventHandler<MouseEvent>> | None | Fired when the ✕ is clicked (Vue: the dismiss emit). |
| instance_key | String | "" | Interaction-state identity (see the STATE HOME delta). |
Accessibility
- The wrap is a live region (role="status", aria-live="polite"): a label that changes while the chip sits in a bar is announced once, politely, without moving focus.
- An interactive chip is a real button with aria-expanded, aria-haspopup and aria-controls pointing at the card's id, so the type of control, the open state and the popup it owns are all stated. A non-interactive chip is a span — correctly not focusable.
- In iconOnly mode the label moves into aria-label, so the chip keeps a name while showing only its glyph.
- The ✕ is a sibling icon button with the i18n Dismiss name; the card is a role="group" whose name is detailLabel (when given) — a group, not a dialog, because it never traps interaction.
- The card is opened by hover and by focus, and a click pins it, so keyboard and touch users get the same card as a mouse user.
- The tone glyph is decorative; the label carries the meaning. Do not rely on tone alone: say what the condition is in the label.
Related components
- PersistentToastGroup — the row of these chips with a "+N" overflow.
- Toast — the transient stack for messages that retire themselves.
- BlockingToast — the prompt that waits for an answer.
- IconButton — the ghost ✕ the dismiss rides.