Class: BetterUi::Forms::TextareaComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- BaseComponent
- BetterUi::Forms::TextareaComponent
- Defined in:
- app/components/better_ui/forms/textarea_component.rb
Overview
A textarea component with support for labels, hints, errors, and prefix/suffix icons.
This component extends BaseComponent to provide a standard textarea field with optional decorative or functional icons positioned before (prefix) or after (suffix) the textarea. Perfect for multi-line text inputs like comments, descriptions, and messages.
Constant Summary
Constants inherited from BaseComponent
Constants inherited from ApplicationComponent
ApplicationComponent::SHADOWS, ApplicationComponent::VARIANTS, ApplicationComponent::VARIANT_BODY_DIVIDE, ApplicationComponent::VARIANT_DIVIDE, ApplicationComponent::VARIANT_HEADER_BG, ApplicationComponent::VARIANT_HEADER_TEXT, ApplicationComponent::VARIANT_HIGHLIGHTED, ApplicationComponent::VARIANT_HOVERABLE, ApplicationComponent::VARIANT_RING, ApplicationComponent::VARIANT_SORT_ICON, ApplicationComponent::VARIANT_STRIPED
Instance Method Summary collapse
-
#initialize(name:, value: nil, label: nil, hint: nil, placeholder: nil, size: :md, disabled: false, readonly: false, required: false, errors: nil, rows: 4, cols: nil, maxlength: nil, resize: :vertical, container_classes: nil, label_classes: nil, input_classes: nil, hint_classes: nil, error_classes: nil, **options) ⇒ TextareaComponent
constructor
Initializes a new textarea component.
-
#with_prefix_icon ⇒ Object
Slot for rendering an icon or content before (left of) the textarea.
-
#with_suffix_icon ⇒ Object
Slot for rendering an icon or content after (right of) the textarea.
Methods inherited from BaseComponent
Constructor Details
#initialize(name:, value: nil, label: nil, hint: nil, placeholder: nil, size: :md, disabled: false, readonly: false, required: false, errors: nil, rows: 4, cols: nil, maxlength: nil, resize: :vertical, container_classes: nil, label_classes: nil, input_classes: nil, hint_classes: nil, error_classes: nil, **options) ⇒ TextareaComponent
Initializes a new textarea component.
All standard parameters are passed to BaseComponent#initialize. See the parent class for detailed parameter descriptions.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'app/components/better_ui/forms/textarea_component.rb', line 113 def initialize( name:, value: nil, label: nil, hint: nil, placeholder: nil, size: :md, disabled: false, readonly: false, required: false, errors: nil, rows: 4, cols: nil, maxlength: nil, resize: :vertical, container_classes: nil, label_classes: nil, input_classes: nil, hint_classes: nil, error_classes: nil, ** ) super( name: name, value: value, label: label, hint: hint, placeholder: placeholder, size: size, disabled: disabled, readonly: readonly, required: required, errors: errors, container_classes: container_classes, label_classes: label_classes, input_classes: input_classes, hint_classes: hint_classes, error_classes: error_classes, ** ) @rows = rows @cols = cols @maxlength = maxlength @resize = resize end |
Instance Method Details
#with_prefix_icon ⇒ Object
Slot for rendering an icon or content before (left of) the textarea. The icon is positioned absolutely at the top left and textarea padding is adjusted automatically.
76 |
# File 'app/components/better_ui/forms/textarea_component.rb', line 76 renders_one :prefix_icon |
#with_suffix_icon ⇒ Object
Slot for rendering an icon or content after (right of) the textarea. The icon is positioned absolutely at the top right and textarea padding is adjusted automatically.
82 |
# File 'app/components/better_ui/forms/textarea_component.rb', line 82 renders_one :suffix_icon |