Class: Fluxbit::Form::HelperTextComponent
- Inherits:
-
Component
- Object
- Component
- Fluxbit::Form::HelperTextComponent
- Includes:
- Config::Form::HelperTextComponent
- Defined in:
- app/components/fluxbit/form/helper_text_component.rb
Overview
The Fluxbit::HelperTextComponent 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) ⇒ HelperTextComponent
constructor
Initializes the helper text component with the given properties.
- #style(color) ⇒ Object
Constructor Details
#initialize(color: nil, **props) ⇒ HelperTextComponent
Initializes the helper text component with the given properties.
15 16 17 18 19 20 |
# File 'app/components/fluxbit/form/helper_text_component.rb', line 15 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
26 27 28 |
# File 'app/components/fluxbit/form/helper_text_component.rb', line 26 def call content_tag :p, content, @props end |
#style(color) ⇒ Object
22 23 24 |
# File 'app/components/fluxbit/form/helper_text_component.rb', line 22 def style(color) styles[:base] + styles[:colors][color] end |