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:, options: {}) ⇒ Hint
constructor
A new instance of Hint.
Constructor Details
#initialize(attribute:, form:, options: {}) ⇒ Hint
Returns a new instance of Hint.
33 34 35 36 37 38 |
# File 'app/components/flowbite/input/hint.rb', line 33 def initialize(attribute:, form:, options: {}) @attribute = attribute @form = form = @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 |
.styles ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/components/flowbite/input/hint.rb', line 16 def styles { default: Flowbite::Style.new( default: ["mt-2", "text-sm", "text-gray-500", "dark:text-gray-400"] ) }.freeze end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/components/flowbite/input/hint.rb', line 25 def call tag.p( content, class: classes, ** ) end |
#classes ⇒ Object
Returns an array with the CSS classes to apply to the label element
41 42 43 |
# File 'app/components/flowbite/input/hint.rb', line 41 def classes self.class.classes(state: state) end |