Class: Flowbite::Input::Hint
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Flowbite::Input::Hint
- Defined in:
- app/components/flowbite/input/hint.rb
Overview
A hint element for input fields.
Provides additional context or instructions for the user.
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.
40 41 42 43 44 45 46 |
# File 'app/components/flowbite/input/hint.rb', line 40 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
16 17 18 19 |
# File 'app/components/flowbite/input/hint.rb', line 16 def classes(state: :default, style: :default) style = styles.fetch(style) style.fetch(state) end |
Instance Method Details
#call ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/components/flowbite/input/hint.rb', line 32 def call tag.p( content, class: classes, **@options ) end |
#classes ⇒ Object
Returns an array with the CSS classes to apply to the label element
49 50 51 |
# File 'app/components/flowbite/input/hint.rb', line 49 def classes self.class.classes(state: state) + @class end |