ProgressDialog

ProgressDialog

HkProgressDialog is the singleton task window: one global surface, opened by a service call rather than by a prop, showing a title, either a determinate bar or an indeterminate spinner, and a scrolling log tail. It renders on top of HkModal with closable: false — a job the user cannot dismiss by pressing Escape midway.

  • Reach for it when a long operation reports progress in words as well as in percent: an import, a build, a migration, a batch upload.
  • There is exactly one of these in an application. That is the point: a caller does not render a component, it calls showProgressDialog({ title }) and gets a handle to push lines and values into. Two concurrent jobs would fight over the same surface, so queue them or give the second one its own body.
  • For a small inline indicator, use the bar itself — ProgressBar — or an Spinner. For a modal the user can dismiss, use Modal.

Import

tsx
1
2
import { HkProgressDialog } from "@celestia-island/hikari";
import { showProgressDialog, useProgressDialog } from "@celestia-island/hikari/composables/useProgressDialog";
rust
1
2
3
use hikari_components::*;          // ProgressDialog, use_progress_dialog, show_progress_dialog,
                                   // ProgressDialogHandle, ProgressDialogState, MAX_LOG_LINES
use hikari_components::prelude::*; // rsx!, VNode

The two implementations are not exported the same way, and this is the single biggest thing to know before writing code against this page:

  • Vue exports the surface component (HkProgressDialog) from the package barrel, but the service — showProgressDialog, useProgressDialog and the ProgressDialogHandle type — is not re-exported from @celestia-island/hikari; it is reachable only through the package's ./composables/* subpath, as in the import above.
  • Rust exports the component (ProgressDialog) and the whole service (show_progress_dialog, use_progress_dialog, ProgressDialogHandle, ProgressDialogState, MAX_LOG_LINES) from the crate root, so the usual glob picks it all up.

The Rust ProgressDialog is the exception to the "every prop may be omitted" rule of this family: it takes no props at all. Everything it renders comes from the singleton store, which is why a Rust fence cannot paint an open window by passing arguments — the example below has to open the store first.

One store, three verbs

showProgressDialog({ title }) (Rust: show_progress_dialog(title)) creates or resets the store — title set, logs emptied, value back to null, max back to 100, open true — and returns a handle. The handle has exactly three verbs on both sides:

  • log(line) appends one line. Past 200 lines the head is trimmed (Vue's MAX_LOG_LINES, Rust's public MAX_LOG_LINES), so a chatty job does not grow the DOM without bound.
  • setProgress(done, total?) sets the value and, when a total is given, the denominator. A missing total keeps the previous max — the same rule on both sides.
  • close() flips open to false.

Every showProgressDialog call resets the whole store, not just its title: the log is emptied and the progress goes back to indeterminate. So a two-stage job that wants to keep its earlier lines has to reuse the first handle instead of opening a second one. There is one store per application, so a second caller opening it mid-job silently takes over the first one's window.

While value is null the body shows the centered spinner; as soon as setProgress has run it shows a small progress bar with its percentage label. Logs below the indicator sit in .s-progress-dialog-log, a monospace pane, and are only rendered at all once there is at least one line.

This example is rendered in the browser and needs JavaScript.

Both cards show the same window: title, a 42/120 bar with its label, and the two log lines. There is no prop to pass — the surface reads the singleton, so the state has to be seeded first.

The log, the scroll and the two forms

The log pane is not its own scroll region. It grows without a cap inside the modal's body scroller, which is the window's single scrollbar (a 2026-09-08 audit removed the nested rail the pane used to carry). Vue then keeps the latest line visible by scrolling that window to the bottom whenever a line arrives. That tailing watcher needs DOM measurement, and the Rust mirror leaves it out: the log simply grows, and scrolling is the host's business.

close() is the only way the window goes away, because the modal is rendered closable: false and the component's update:modelValue handler is a deliberate no-op. That has one consequence a caller must plan for: the ✕ is never rendered, and neither Escape nor an overlay press dismisses the window. If a job can hang, give the user another way out — a cancel button in the page around it, a watchdog that calls close().

[D] use_progress_dialog() (Rust) / useProgressDialog() (Vue) both return the raw store rather than a copy — in Rust a Signal<ProgressDialogState>; every call returns a clone of the same handle, so two components reading it see the same state. In Vue the store is a reactive object, so a component that reads state.logs re-renders as lines arrive; in Rust the read is a snapshot taken when ProgressDialog renders, and the host re-renders on the signal's change.

This example is rendered in the browser and needs JavaScript.

The indeterminate branch: with no setProgress call the window shows a spinner and the log, which is the right shape for a job that cannot report a percentage.

What is Vue-only, and what the mirror leaves out

  • Title, width, closability. Both forms pin the same chrome: closable: false and a 30rem width. Neither is configurable, so a job with a long title truncates rather than widening the window.
  • Tailing. Vue scrolls the window to the newest line on every append; the Rust mirror has no measurement pass, so its log just grows and the host scrolls.
  • Runtime registration. Vue's service reports itself into the runtime registry (readHkRuntime("progressDialog")) on first use, so the live dialog tree can be inspected; the Rust store has no counterpart.
  • No afterLeave, no back guard. The surface exposes no leave event on either side. Vue's modal would push a history entry for the back gesture, but the guard is gated on closable, which is false here, so the window never consumes a back press; the Rust frame has neither.
This example is rendered in the browser and needs JavaScript.

A job that only has a step count: setProgress(0, 3) fixes the denominator up front, so every later setProgress(n) call without a total keeps the bar at three parts and only moves the fill.

API

Vue

Rust

Props — ProgressDialog

The two tables above are empty on purpose: both forms read as prop-less here, and the generated block says so by printing only the headings. ProgressDialog declares no props at all — not even an empty struct — and the Vue surface declares none either. Their entire contract is the singleton service and its handle, documented under "One store, three verbs"; the closing setProgress / close behaviour is the only API these two components have.

Accessibility

  • The window is the modal's role="dialog" with aria-modal="true", and it is named: the store's title reaches the frame's aria-label as well as its visible heading, so the rendered markup carries aria-label="<title>" (verified against the built snapshot). The title is the only name there is — a job that needs more context belongs in the log lines.
  • Nothing here is a live region. Neither log() nor setProgress() announces anything to assistive technology, so a blind user learns progress only by navigating into the dialog. A page that needs spoken progress should mirror the handle's state into its own aria-live="polite" status line — the store is readable for exactly that.
  • There is no dismissal affordance: no ✕, no Escape, no overlay press. That is correct for a job that must finish, but it means the caller owns the escape hatch. Always pair a progress window with a cancel path (a button in the surrounding page, a timeout that calls close()), otherwise a hung job leaves the user with a window they cannot leave.
  • The log pane is monospace and plain: each entry is a bare <li> with no role and no styling of its own, so a line that says "failed" or "skipped" is read as ordinary text inside the dialog. Anything a user must be told rather than able to find should go through the status line below, not through colour or position in the tail.
  • The Rust surface takes no props and renders nothing while the store is closed, so a host that mounts it once at the app root and drives it only through show_progress_dialog matches the Vue contract exactly.

Related components

  • Modal — the frame this window sits on, and the choice when the user must be able to dismiss.
  • ProgressBar — the track inside this window, and the inline indicator for everything smaller.
  • Spinner — the indeterminate state a job shows before its first measurement.
  • ConfirmDialog — the decision that usually starts a job like this.
  • Toast — the short-lived notice for a job that finished while the user was elsewhere.