Class: Fluxbit::Form::HelperTextComponent

Inherits:
Component
  • Object
show all
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

Constructor Details

#initialize(color: nil, **props) ⇒ HelperTextComponent

Initializes the helper text component with the given properties.

Options Hash (**props):

  • **props (Hash)

    Remaining options declared as HTML attributes, applied to the helper text element.



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

#callObject



26
27
28
# File 'app/components/fluxbit/form/helper_text_component.rb', line 26

def call
   :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