Class: RubyUI::TabsTrigger

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

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(value:, as: :button, **attrs) ⇒ TabsTrigger

Returns a new instance of TabsTrigger.



5
6
7
8
9
# File 'lib/ruby_ui/tabs/tabs_trigger.rb', line 5

def initialize(value:, as: :button, **attrs)
  @value = value
  @as = as
  super(**attrs)
end

Instance Method Details

#view_templateObject



11
12
13
14
15
16
17
# File 'lib/ruby_ui/tabs/tabs_trigger.rb', line 11

def view_template(&)
  if @as == :a
    a(**attrs, &)
  else
    button(**attrs, &)
  end
end