Button
Reusable button component.
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
| Prop | Type | Requirement | Default |
|---|---|---|---|
label | string | Optional | "Button" |
type | string | Optional | "button" |
variant | string | Optional | "primary" |
size | string | Optional | "md" |
disabled | boolean | Optional | false |
loading | boolean | Optional | false |
icon | string | Optional | "" |
className | string | Optional | "" |
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>
}
}