defmodule PhiaUi.Components.TextareaCounter do @moduledoc """ Textarea with a character counter and optional max-length enforcement. Provides `textarea_counter/1` — a standalone `
{if @max_length, do: "#{@current} / #{@max_length}", else: "#{@current}"}
""" end # --------------------------------------------------------------------------- # phia_textarea_counter/1 # --------------------------------------------------------------------------- attr(:field, Phoenix.HTML.FormField, required: true, doc: "A `Phoenix.HTML.FormField` struct from `@form[:field_name]`." ) attr(:label, :string, default: nil, doc: "Label text rendered above the textarea." ) attr(:description, :string, default: nil, doc: "Helper text rendered below the label." ) attr(:max_length, :integer, default: nil, doc: "Maximum allowed character count." ) attr(:rows, :integer, default: 4, doc: "Number of visible text rows." ) attr(:show_count, :boolean, default: true, doc: "Whether to show the character counter." ) attr(:class, :string, default: nil, doc: "Additional CSS classes merged into the `