Class: Maglev::Uikit::Form::CheckboxComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Maglev::Uikit::Form::CheckboxComponent
- Defined in:
- app/components/maglev/uikit/form/checkbox_component.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#placeholder ⇒ Object
readonly
Returns the value of attribute placeholder.
Instance Method Summary collapse
- #checked? ⇒ Boolean
- #dom_id ⇒ Object
-
#initialize(label:, name:, checked: false, placeholder: nil) ⇒ CheckboxComponent
constructor
A new instance of CheckboxComponent.
Constructor Details
#initialize(label:, name:, checked: false, placeholder: nil) ⇒ CheckboxComponent
Returns a new instance of CheckboxComponent.
9 10 11 12 13 14 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 9 def initialize(label:, name:, checked: false, placeholder: nil) @label = label @name = name @checked = checked @placeholder = placeholder end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 7 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 7 def name @name end |
#placeholder ⇒ Object (readonly)
Returns the value of attribute placeholder.
7 8 9 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 7 def placeholder @placeholder end |
Instance Method Details
#checked? ⇒ Boolean
16 17 18 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 16 def checked? @checked end |
#dom_id ⇒ Object
20 21 22 |
# File 'app/components/maglev/uikit/form/checkbox_component.rb', line 20 def dom_id name.to_s.parameterize.underscore end |