Class: Fluxbit::Form::HelpTextComponent
- Inherits:
-
Component
- Object
- Component
- Fluxbit::Form::HelpTextComponent
- Includes:
- Config::Form::HelpTextComponent
- Defined in:
- app/components/fluxbit/form/help_text_component.rb
Overview
The ‘Fluxbit::HelpTextComponent` is a component for rendering customizable helper text elements. It extends `Fluxbit::Component` and provides options for configuring the helper text’s appearance and behavior. You can control the helper text’s color and other attributes. The helper text can have various styles applied based on the provided properties.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(color: nil, **props) ⇒ HelpTextComponent
constructor
Initializes the helper text component with the given properties.
- #style(color) ⇒ Object
Constructor Details
#initialize(color: nil, **props) ⇒ HelpTextComponent
Initializes the helper text component with the given properties.
20 21 22 23 24 25 |
# File 'app/components/fluxbit/form/help_text_component.rb', line 20 def initialize(color: nil, **props) super @props = props color = @@color unless color.in? %i[info default success failure warning] add class: style(color), to: @props, first_element: true end |
Instance Method Details
#call ⇒ Object
31 32 33 |
# File 'app/components/fluxbit/form/help_text_component.rb', line 31 def call content_tag :p, content, @props end |
#style(color) ⇒ Object
27 28 29 |
# File 'app/components/fluxbit/form/help_text_component.rb', line 27 def style(color) styles[:base] + styles[:colors][color] end |