CodeCopyButton
Reusable code copy button component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<CodeCopyButton
label="Action"
href="href"
type="button"
variant="primary"
disabled="false"
/>Legacy mount name: data-component="CodeCopyButton".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
label | string | Optional | "Action" |
href | string | Optional | "" |
type | string | Optional | "button" |
variant | string | Optional | "primary" |
disabled | boolean | Optional | false |
class | string | Optional | "" |
Slots
default
Events
This component does not declare a custom event.
Source contract
Installed source: components/CodeCopyButton.wrn
component CodeCopyButton {
props {
label = "Action"
href = ""
type = "button"
variant = "primary"
disabled = false
class = ""
}
view {
<span class="wire-catalog-action {class}">
<a data-show="href" href="{href}" class="wire-btn wire-btn--{variant}">{label}<slot />
</a>
<button data-show="!href" type="{type}" disabled="{disabled}" class="wire-btn wire-btn--{variant}">{label}<slot />
</button>
</span>
}
}