Skip to content
W WRNexusJS
core component

theme-toggle

Reusable theme-toggle component.

@wrnexus/ui 0.2.672 props1 slots0 events

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

PropTypeRequirementDefault
labelstringOptional"Toggle theme"
classstringOptional""

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>
    }
}