Class: BetterUi::General::Field::Component
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- BetterUi::General::Field::Component
- Defined in:
- app/components/better_ui/general/field/component.rb
Constant Summary collapse
- BASE_CLASSES =
"flex flex-col space-y-2"
- LABEL_CLASSES =
"text-sm font-medium text-gray-700"
- REQUIRED_CLASSES =
"text-red-500 ml-1"
- ERROR_CLASSES =
"text-sm text-red-600 mt-1"
- HELP_TEXT_CLASSES =
"text-sm text-gray-500 mt-1"
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#help_text ⇒ Object
readonly
Returns the value of attribute help_text.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, name:, required: false, error: nil, help_text: nil, id: nil) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(text:, name:, required: false, error: nil, help_text: nil, id: nil) ⇒ Component
Returns a new instance of Component.
17 18 19 20 21 22 23 24 25 |
# File 'app/components/better_ui/general/field/component.rb', line 17 def initialize(text:, name:, required: false, error: nil, help_text: nil, id: nil) @text = text @name = name @required = required @error = error @help_text = help_text @id = id super() end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def error @error end |
#help_text ⇒ Object (readonly)
Returns the value of attribute help_text.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def help_text @help_text end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def required @required end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'app/components/better_ui/general/field/component.rb', line 7 def text @text end |