page Buttoncomponent { seo { title = "Button component" description = "Reusable button component." } view {
W WRNexusJS
actions component

Button

Reusable button component.

@wrnexus/ui 0.2.778 props0 slots0 events

Usage

Components are auto-discovered. Use the component directly in any .wrn view:

<Button
  label="Button"
  type="button"
  variant="primary"
  size="md"
  disabled="false"
/>

Legacy mount name: data-component="Button".

Props and attributes

PropTypeRequirementDefault
labelstringOptional"Button"
typestringOptional"button"
variantstringOptional"primary"
sizestringOptional"md"
disabledbooleanOptionalfalse
loadingbooleanOptionalfalse
iconstringOptional""
classNamestringOptional""

Slots

This component does not declare a slot.

Events

This component does not declare a custom event.

Source contract

Installed source: components/Button.wrn

component Button {
  props {
    label = "Button"
    type = "button"
    variant = "primary"
    size = "md"
    disabled = false
    loading = false
    icon = ""
    className = ""
  }

  view {
        <button
      type="{type}"
      disabled="{disabled || loading}"
      aria-busy="{loading}"
      class="wire-btn wire-btn--{variant} wire-btn--{size} {className}"
    >
      {#if loading}
        <span class="wire-spinner" aria-hidden="true">
        </span>
      {/if}

      {#if icon && !loading}
        <span class="{icon} size-4" aria-hidden="true">
        </span>
      {/if}

      <span>{label}</span>
        </button>
    }
}
} }