Text area
Collects text that spans several lines, such as a message template or a query.
Default
Shows the character count against
max_length
.
0/200
<.text_area
id="text-area-default"
name="message"
label="Message template"
placeholder="Enter message template..."
/>
Label and hint
(Optional)
0/200
Shown to everyone in the organization.
<.text_area
id="text-area-label-hint"
name="description"
label="Description"
sublabel="(Optional)"
placeholder="What this automation does and who it notifies"
hint="Shown to everyone in the organization."
/>
Character limit
Raise
max_length
for long content, or hide the counter.
79/2000
<.text_area
id="text-area-limit"
name="message"
label="Slack message"
max_length={2000}
value="Flaky test detected in AppTests: the test failed and passed on the same commit."
/>
<.text_area
id="text-area-no-count"
name="query"
label="Query"
rows={8}
max_length={10_000}
show_character_count={false}
placeholder="SELECT id, name FROM accounts ORDER BY inserted_at DESC LIMIT 50;"
/>
Error
*
0/200
Enter a message to send
<.text_area
id="text-area-error"
name="message"
label="Message template"
value=""
error="Enter a message to send"
required
show_required
/>
Disabled
Hides the character count and turns off resizing.
<.text_area
id="text-area-disabled"
name="message"
label="Message template"
value="Build failed on main. Check the logs in the Tuist dashboard."
disabled
/>
Guidelines
-
max_lengthcaps the text and defaults to 200 characters. Raise it for long content, and hide the counter withshow_character_count={false}when people are unlikely to reach the limit. -
The character count is computed from
valueon the server. It changes as people type only when aphx-changehandler sends the new value back. -
Set
rowsto fit the content you expect, so people see most of it without scrolling. -
errorreplaces the hint and outlines the field. Passshow_error_message={false}to keep the outline without the message. -
Inside a form, pass
field. The text area then takes its id, name, value, and first error from the form field.
API reference
<.text_area>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
disabled
|
boolean
|
false
|
Whether the textarea is disabled.
|
|
error
|
string
|
–
|
Errors to be rendered below the textarea. Takes precedence over
hint
.
|
|
field
|
Phoenix.HTML.FormField
|
–
|
A Phoenix form field
|
|
hint
|
string
|
nil
|
Hint text to be rendered below the textarea.
|
|
hint_variant
|
string
|
"default"
|
Hint text variant.
|
|
id
|
string
|
–
|
|
|
label
|
string
|
nil
|
Label to be rendered above the textarea.
|
|
max_length
|
integer
|
200
|
Maximum number of characters allowed.
|
|
name
|
string
|
–
|
The name of the textarea
|
|
placeholder
|
string
|
nil
|
Placeholder text to be rendered in the textarea.
|
|
required
|
boolean
|
false
|
Whether the textarea is required.
|
|
resize
|
string
|
"vertical"
|
CSS resize property for the textarea.
"none""both""horizontal""vertical"
|
|
rows
|
integer
|
4
|
Number of visible text lines for the textarea.
|
|
show_character_count
|
boolean
|
true
|
Whether to show the character count.
|
|
show_error_message
|
boolean
|
true
|
Whether to show the error message below the textarea.
|
|
show_required
|
boolean
|
false
|
Whether the required indicator is shown.
|
|
sublabel
|
string
|
nil
|
Sublabel to be rendered above the textarea.
|
|
value
|
string
|
–
|
The value of the textarea
|
Also accepts global attributes, including autocompleteautocorrect.
| Slot | Description |
|---|---|
|
:overlay
|
Decorative content behind the textarea. Hidden until enabled by a client hook; callers own its styling.
|