WarUI documentation

Loading button

stable

Mark the action as busy while work is in progress.

Live example

Example controls

Expected behavior

The spinner appears, the label remains available to screen readers, and clicks are ignored.

Source

<war-button loading>Save changes</war-button>

API reference

war-button manifest
KindNameTypeDescription
Propertyvariant'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost' | 'link'—
Propertysize'sm' | 'md' | 'lg'—
PropertyfullWidthboolean—
PropertyiconOnlyboolean—
Propertylabelstring—
Propertyloadingboolean—
Propertydisabledboolean—
PropertysoftDisabledboolean—
Propertyhrefstring | undefined—
Propertytargetstring | undefined—
Propertyrelstring | undefined—
Propertydownloadstring | undefined—
Propertytype'button' | 'submit' | 'reset'—
Propertynamestring—
Propertyvaluestring—
PropertyformHTMLFormElement | null—
Attributevariant'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost' | 'link'Visual emphasis.
Attributesize'sm' | 'md' | 'lg'Size of the control.
Attributefull-widthbooleanFill the available inline space.
Attributeicon-onlybooleanDisplay the default slot as an icon.
AttributelabelstringExplicit accessible name.
AttributeloadingbooleanPending state blocks activation.
AttributedisabledbooleanRemove from the tab order and block activation.
Attributesoft-disabledbooleanRemain focusable but block activation.
Attributehrefstring | undefinedRender a link instead of a button.
Attributetargetstring | undefinedLink target context.
Attributerelstring | undefinedLink relationship.
Attributedownloadstring | undefinedSuggested download name.
Attributetype'button' | 'submit' | 'reset'Native form action.
AttributeformstringID of the associated form.
AttributenamestringSubmitter name.
AttributevaluestringSubmitter value.
Eventwar-clickCustomEvent<{type:string}>Cancelable event before activation.
Slot(default)—Visible label or icon.
Slotstart—Leading content.
Slotend—Trailing content.
CSS partbase—Native control.
CSS partlabel—Label wrapper.
CSS partstart—Leading content wrapper.
CSS partend—Trailing content wrapper.
CSS partspinner—Loading indicator.
CSS property--war-button-background—Custom background.
CSS property--war-button-foreground—Custom foreground.
CSS property--war-button-border—Custom border color.