Skip to content

Loading Button

The in-flight preset of Button: set loading while the action runs. An inline spinner replaces the leading icon (or the glyph, for icon-only buttons), presses are ignored, and the label stays visible — the button never changes size or loses focus.

loadingStatus feeds a live status message for multi-step operations (“Uploading…” → “Processing…”): visually hidden, announced politely to assistive tech on every change.

<script>
import Button from "@invisible-ui/svelte/Button.svelte";
</script>
PropTypeDefaultDescription
actionAction<HTMLElement>() => {}Optional extra Svelte action applied to the underlying <button>. Overlay components (Dialog, Popover, …) pass their triggerAction here to compose the Button as their trigger.
variantButtonVariant"default"
disabledbooleanfalse
loadingbooleanfalseLoading state: shows an inline spinner in place of the leading icon (or of the glyph, for icon-only buttons), announces aria-busy and ignores presses. The label stays visible and the button stays focusable.
loadingStatusstring | undefinedundefinedLive loading message announced on every change while loading — for a succession of backend-reported steps ("Uploading…" → "Processing…"). It is visually hidden (the button label stays stable); assistive tech hears each step through the spinner's polite status region.
type"button" | "submit" | "reset""button"
onpress((event: Event) => void) | undefinedundefinedCalled when activated (click, or Enter/Space).
copystring | undefinedundefinedText to copy to the clipboard when the button is pressed. After a successful copy, a confirmation shows beside the button for two seconds and is announced politely (ADR 0016).
copiedLabelstring | undefinedundefinedThe confirmation shown after a copy. Defaults to the i18n catalog's "Copied".
leftIconboolean | undefinedundefinedShow a leading icon. Defaults on for danger.
rightIconbooleanfalseShow a trailing icon.
iconOnlybooleanfalseSquare, icon-only button (pass one icon as children + an ariaLabel). The CloseButton is a preset of this.
ariaLabelstring | undefinedundefinedAccessible name; required for icon-only buttons.
leftSnippet | undefinedundefinedReplaces the built-in leading icon.
rightSnippet | undefinedundefinedReplaces the built-in trailing icon.
  • While loading, the button exposes aria-busy, stays focusable and ignores presses — no disappearing controls, no focus loss.
  • Step announcements go through the spinner’s polite status region (loadingStatus), so the visible label never flickers.
<Button variant="primary" loading={saving} loadingStatus="Saving…" onpress={save}>
Save changes
</Button>

Themeable via the shared --ds-components-button-*.