theme-toggle
Reusable theme-toggle component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<theme-toggle
label="Toggle theme"
/>Legacy mount name: data-component="theme-toggle".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
label | string | Optional | "Toggle theme" |
class | string | Optional | "" |
Slots
default
Events
This component does not declare a custom event.
Source contract
Installed source: components/theme-toggle.wrn
// Theme switch button. The framework's theme runtime binds the click
// (data-wire-theme-toggle), so no component JS is needed.
component ThemeToggle {
props {
label = "Toggle theme"
class = ""
}
view {
<button type="button" class="wire-btn wire-btn--ghost {class}" data-wire-theme-toggle>
<slot>{label}</slot>
</button>
}
}