DevactionUI.Textarea (devaction_ui v0.2.3)

Copy Markdown View Source

A text area as the canvas draws it: it grows with its text (field-sizing: content, up to 12 lines), has an optional footer for actions (attach, mention, improve with the AI) and a counter that turns red near the limit. The label and the help text are the caller's; this is the field.

rows is the least it shows, and aria-invalid sits on the <textarea> only: the frame reads it for the error ring. With a maxlength the counter is part of the field's description (aria-describedby, joined to one the caller gives) and is announced politely once it is near the limit.

Summary

Functions

A small button of the footer of a textarea/1, with an icon and an optional text.

Whether count characters are within 10% of max.

Functions

near_limit?(count, max)

@spec near_limit?(non_neg_integer(), pos_integer()) :: boolean()

Whether count characters are within 10% of max.

textarea(assigns)

Attributes

  • id (:string) (required)
  • name (:string) - Defaults to nil.
  • value (:string) - Defaults to nil.
  • rows (:integer) - Defaults to 3.
  • maxlength (:integer) - shows the counter and turns it red near the limit. Defaults to nil.
  • invalid (:boolean) - Defaults to false.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["placeholder", "disabled", "readonly", "required", "minlength", "form", "wrap"].

Slots

  • footer - actions under the text, at the start; the counter sits at the end.