SutraUI.Textarea (Sutra UI v0.2.0)

View Source

Displays a multi-line text input field.

Examples

# Basic textarea
<.textarea name="bio" placeholder="Tell us about yourself" />

# Textarea with custom rows
<.textarea name="description" rows={6} />

# Disabled textarea
<.textarea name="readonly_content" disabled />

# Textarea with form field
<.textarea field={@form[:message]} />

# Textarea with character limits
<.textarea name="summary" minlength="10" maxlength="500" />

# Textarea with ARIA attributes
<.textarea
  name="feedback"
  aria-label="Your feedback"
  aria-describedby="feedback-help"
/>

Accessibility

  • aria-label - Label for the textarea when no visible label is present
  • aria-describedby - References helper text or error messages
  • aria-invalid - Indicates validation state

Summary

Functions

Renders a textarea component.

Functions

textarea(assigns)

Renders a textarea component.

Examples

<.textarea name="bio" placeholder="Tell us about yourself" />
<.textarea name="bio" rows={6} />
<.textarea name="bio" disabled />
<.textarea field={@form[:message]} />

Attributes

  • field (Phoenix.HTML.FormField) - A form field struct retrieved from the form.
  • id (:string) - The id attribute. Defaults to nil.
  • name (:string) - The name attribute. Defaults to nil.
  • value (:string) - The value. Defaults to nil.
  • placeholder (:string) - Placeholder text. Defaults to nil.
  • rows (:integer) - Number of visible text lines. Defaults to 3.
  • class (:string) - Additional CSS classes. Defaults to nil.
  • Global attributes are accepted. Additional HTML attributes. Supports all globals plus: ["disabled", "required", "readonly", "autofocus", "minlength", "maxlength", "aria-label", "aria-describedby", "aria-invalid"].