Class: Flowbite::Input::Hint
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Input::Hint
- Defined in:
- app/components/flowbite/input/hint.rb
Constant Summary collapse
- STATES =
[ DEFAULT = :default ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#classes ⇒ Object
Returns an array with the CSS classes to apply to the label element.
-
#initialize(attribute:, form:, class: nil, options: {}) ⇒ Hint
constructor
A new instance of Hint.
Constructor Details
#initialize(attribute:, form:, class: nil, options: {}) ⇒ Hint
Returns a new instance of Hint.
35 36 37 38 39 40 41 |
# File 'app/components/flowbite/input/hint.rb', line 35 def initialize(attribute:, form:, class: nil, options: {}) @attribute = attribute @class = Array.wrap(binding.local_variable_get(:class)) @form = form @options = @object = form.object end |
Class Method Details
.classes(state: :default, style: :default) ⇒ Object
11 12 13 14 |
# File 'app/components/flowbite/input/hint.rb', line 11 def classes(state: :default, style: :default) style = styles.fetch(style) style.fetch(state) end |
Instance Method Details
#call ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/components/flowbite/input/hint.rb', line 27 def call tag.p( content, class: classes, **@options ) end |
#classes ⇒ Object
Returns an array with the CSS classes to apply to the label element
44 45 46 |
# File 'app/components/flowbite/input/hint.rb', line 44 def classes self.class.classes(state: state) + @class end |