AuthSubmitButton

AuthSubmitButton

HkAuthSubmitButton is the submit control of a sign-in or sign-up form: a block-level Button that runs the authentication challenge lifecycle for the host and shows how far it got. One press asks the backend for a proof-of-work challenge, solves it, acquires a captcha token when the flow needs one, and finally hands the assembled context to doSubmit. While that runs the button shows its loading look — a spinner beside the caption — and a failure shows as an error line under the button.

  • A plain form submit that needs none of this is a Button with type="submit".
  • A single-provider redirect has its own control, HkAuthSsoButton.

Import

tsx
1
import { HkAuthSubmitButton } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // AuthSubmitButton, ButtonSize, ButtonVariant
use hikari_components::prelude::*; // rsx!, VNode

States

label is required. loading is the host's own in-flight flag; disabled locks the button on top of the built-in busy lock; error renders the line under the button. The Rust mirror takes the same three props; what it does not take is the lifecycle — see the notes below.

Invalid credentials

Size and variant

Without block the button keeps its natural width. size and variant are those of the underlying button; the Rust form accepts the full button variant set.

Interaction

doSubmit is required and is the end of the lifecycle. onGetChallenge returns the proof-of-work challenge or null to skip it; solver replaces the built-in solver; onCaptcha returns a token or null. solvingLabel replaces the caption while the challenge is being solved — by default the caption stays and a spinner appears beside it. Anything that throws is reported through the error event. The example runs the whole cycle with a small challenge; a Rust snapshot cannot take part, because a snapshot never runs a handler.

TSX

Not signed in yet.

API

Vue

Props

NameTypeDefaultRequired
labelString—✓
solvingLabelStringundefined—
loadingBooleanfalse—
disabledBooleanfalse—
errorStringundefined—
blockBooleanfalse—
size<code>String as () => "sm" | "md" | "lg"</code>"md"—
variant<code>String as () => "primary" | "secondary" | "ghost"</code>"primary"—
onGetChallenge<code>Function as PropType<() => Promise<PowChallenge | null>></code>undefined—
solverFunction as PropType<(c: PowChallenge) => Promise<number>>undefined—
onCaptcha<code>Function as PropType<() => Promise<string | null>></code>undefined—
doSubmitFunction as PropType<(ctx: AuthSubmitContext) => Promise<void>>—✓

Emits

EventPayload
errorstring

Rust

Props — AuthSubmitButton

PropTypeDefaultDescription
labelOption<String>NoneSubmit caption (Vue: label, required); None uses the locale string.
solving_labelOption<String>NoneCaption shown while the challenge is being solved (Vue: solvingLabel).
loadingboolfalseExternal in-flight state (the consumer's request/in-flight flag).
solvingboolfalseIn-component challenge state — Vue's local solving ref, promoted to a controlled prop (see the file header delta).
disabledboolfalseExtra guard on top of the built-in busy lock.
errorOption<String>NoneFailure message rendered under the button (Vue: error).
blockboolfalseFull-width presentation (Vue: block).
sizeButtonSizeButtonSize::MdButton size step (Vue: <code>"sm" | "md" | "lg"</code>, default md).
variantButtonVariantButtonVariant::PrimaryButton voice (Vue: <code>"primary" | "secondary" | "ghost"</code>, default primary).
on_submitOption<EventHandler<()>>NoneThe click intent — Vue's doSubmit entry point (the challenge lifecycle itself is host-owned; see the file header delta).
classString""Host class, appended to the .s-auth-submit wrapper (Vue falls attrs.class through to the root element).

Notes

  • The Rust mirror keeps no state (the ledger's state contract): solving is a prop the host flips while its own challenge work runs, and the four callbacks collapse into one click intent, on_submit. The busy look is identical — loading || solving.
  • In the Rust form label is optional and falls back to the locale string; in Vue it is required.
  • A second press while the button is busy is dropped; it does not queue another round.

Accessibility

  • The button inherits the button's behaviour: a real <button>, aria-busy and the native disabled attribute while busy.
  • The error line is a plain paragraph under the button. Read it out by living-region or associate it explicitly (aria-describedby) in the surrounding form when the flow requires it.

Related components