Class: Tailwinds::Form::SubmitButtonComponent

Inherits:
TailwindComponent show all
Defined in:
app/components/tailwinds/form/submit_button_component.rb

Overview

Tailwind-styled submit button

Constant Summary

Constants inherited from TailwindComponent

TailwindComponent::SIZE_CLASSES

Constants included from Tramway::Helpers::ViewsHelper

Tramway::Helpers::ViewsHelper::FORM_SIZES

Instance Method Summary collapse

Methods included from Tramway::Helpers::ViewsHelper

#tramway_back_button, #tramway_badge, #tramway_button, #tramway_cell, #tramway_container, #tramway_flash, #tramway_form_for, #tramway_header, #tramway_main_container, #tramway_row, #tramway_table, #tramway_title

Methods included from Tramway::Helpers::ComponentHelper

#component

Methods included from Tramway::Helpers::DecorateHelper

#tramway_decorate

Constructor Details

#initialize(action, size: :medium, **options) ⇒ SubmitButtonComponent

Returns a new instance of SubmitButtonComponent.



7
8
9
10
11
12
13
14
15
# File 'app/components/tailwinds/form/submit_button_component.rb', line 7

def initialize(action, size: :medium, **options)
  unless size.in?(%i[small medium large])
    raise ArgumentError, "Invalid size: #{size}. Valid sizes are :small, :medium, :large."
  end

  @text = action.is_a?(String) ? action : action.to_s.capitalize

  super(input: nil, attribute: nil, value: nil, options: options.except(:type), label: nil, for: nil, size:)
end