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
;
use *; // AuthSubmitButton, ButtonSize, ButtonVariant
use *; // 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.
Not signed in yet.
API
Vue
Props
| Name | Type | Default | Required |
|---|---|---|---|
| label | String | — | ✓ |
| solvingLabel | String | undefined | — |
| loading | Boolean | false | — |
| disabled | Boolean | false | — |
| error | String | undefined | — |
| block | Boolean | false | — |
| 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 | — |
| solver | Function as PropType<(c: PowChallenge) => Promise<number>> | undefined | — |
| onCaptcha | <code>Function as PropType<() => Promise<string | null>></code> | undefined | — |
| doSubmit | Function as PropType<(ctx: AuthSubmitContext) => Promise<void>> | — | ✓ |
Emits
| Event | Payload |
|---|---|
| error | string |
Rust
Props — AuthSubmitButton
| Prop | Type | Default | Description |
|---|---|---|---|
| label | Option<String> | None | Submit caption (Vue: label, required); None uses the locale string. |
| solving_label | Option<String> | None | Caption shown while the challenge is being solved (Vue: solvingLabel). |
| loading | bool | false | External in-flight state (the consumer's request/in-flight flag). |
| solving | bool | false | In-component challenge state — Vue's local solving ref, promoted to a controlled prop (see the file header delta). |
| disabled | bool | false | Extra guard on top of the built-in busy lock. |
| error | Option<String> | None | Failure message rendered under the button (Vue: error). |
| block | bool | false | Full-width presentation (Vue: block). |
| size | ButtonSize | ButtonSize::Md | Button size step (Vue: <code>"sm" | "md" | "lg"</code>, default md). |
| variant | ButtonVariant | ButtonVariant::Primary | Button voice (Vue: <code>"primary" | "secondary" | "ghost"</code>, default primary). |
| on_submit | Option<EventHandler<()>> | None | The click intent — Vue's doSubmit entry point (the challenge lifecycle itself is host-owned; see the file header delta). |
| class | String | "" | 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
- Button — the button underneath.
- HkAuthSsoButton — a single-provider redirect trigger.