x
1
2
3
4
5
6
7
<form class="usa-form" id="new_text_area_component_preview_article" action="#" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="-L4V5Bf1XwuvR7_he2GBXueBxtfauqCfulTXMuoYuVVgh2qYTFhe2bovfJzzv6Z8c_iSdf6reDQWPaPsd6ztlQ" autocomplete="off" /> <div class=''> <label class="usa-label" for="text_area_component_preview_article_body">Body</label> <textarea class="usa-textarea" name="text_area_component_preview_article[body]" id="text_area_component_preview_article_body"></textarea> </div></form>
1
2
3
4
5
6
7
8
9
-# haml-lint:disable LineLength- article = UswdsComponents::TextAreaComponentPreview::Article.new(body: params[:value])-# haml-lint:enable LineLength- article.errors.add(:body, params[:error1]) if params[:error1].present?- article.errors.add(:body, params[:error2]) if params[:error2].present?= form_for article, url: '#', html: { class: 'usa-form' } do |f| = render UswdsComponents::TextAreaComponent.new(form: f, attribute: :body)
Text Area Component
The Text Area Component is designed for a text area field in a form backed
by an ActiveModel object. In the preview example that is the body
attribute of an Article
object.
The preview allows you to set error messages on the title attribute. But the component displays the full message of the errors. That is why the attribute name is prepended.
Param | Description | Input |
---|---|---|
— |
|
|
— |
|
|
— |
|