Class: RubyUI::ThemeToggle

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/theme_toggle/theme_toggle.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RubyUI::Base

Instance Method Details

#view_template(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ruby_ui/theme_toggle/theme_toggle.rb', line 5

def view_template(&block)
  RubyUI.Toggle(
    variant: :default,
    size: :default,
    aria: {label: "Toggle theme"},
    wrapper: {
      data: {
        controller: "ruby-ui--theme-toggle",
        action: "ruby-ui--toggle:change->ruby-ui--theme-toggle#apply"
      }
    },
    **attrs,
    &block
  )
end