Class: UI::CheckboxComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::CheckboxComponent
- Includes:
- CheckboxBehavior
- Defined in:
- app/view_components/ui/checkbox_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name: nil, id: nil, value: nil, checked: false, disabled: false, required: false, classes: "", **attributes) ⇒ CheckboxComponent
constructor
A new instance of CheckboxComponent.
Methods included from CheckboxBehavior
#checkbox_classes, #checkbox_data_attributes, #checkbox_html_attributes, #checkbox_id
Constructor Details
#initialize(name: nil, id: nil, value: nil, checked: false, disabled: false, required: false, classes: "", **attributes) ⇒ CheckboxComponent
Returns a new instance of CheckboxComponent.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/view_components/ui/checkbox_component.rb', line 6 def initialize( name: nil, id: nil, value: nil, checked: false, disabled: false, required: false, classes: "", **attributes ) @name = name @id = id @value = value @checked = checked @disabled = disabled @required = required @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/view_components/ui/checkbox_component.rb', line 26 def call content_tag :div, class: "relative inline-flex items-center justify-center" do safe_join([ content_tag(:input, nil, checkbox_html_attributes), checkmark_icon ]) end end |