Class: PhlexKit::Textarea
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::Textarea
- Defined in:
- app/components/phlex_kit/textarea/textarea.rb
Overview
Multi-line text input, ported from ruby_ui's RubyUI::Textarea. Same plain-CSS
treatment (and form-field wiring) as PhlexKit::Input — rows: sets the initial height,
the yielded block is the textarea's content (an edit form's current value),
and every other attr (name:, id:, placeholder:, **on(...)) passes
through via mix. No VARIANTS. Styled by .pk-textarea (textarea.css).
Instance Method Summary collapse
-
#initialize(rows: 4, **attrs) ⇒ Textarea
constructor
A new instance of Textarea.
- #view_template(&block) ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(rows: 4, **attrs) ⇒ Textarea
Returns a new instance of Textarea.
8 9 10 11 |
# File 'app/components/phlex_kit/textarea/textarea.rb', line 8 def initialize(rows: 4, **attrs) @rows = rows @attrs = attrs end |
Instance Method Details
#view_template(&block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/phlex_kit/textarea/textarea.rb', line 13 def view_template(&block) textarea(**mix({ rows: @rows, class: "pk-textarea", data: { phlex_kit__form_field_target: "input", action: "input->phlex-kit--form-field#onInput invalid->phlex-kit--form-field#onInvalid" } }, @attrs), &block) end |