FlexTextareaField extends Filament’s Textarea. It stores ordinary text and preserves the native form lifecycle, while adding an animated height, a live counter and optional toolbar controls.
Basic usage
maxHeight(null) to remove the cap, or use autosize(false)->rows(5) for a fixed-height field. animatedAutosize(false) keeps automatic resizing without its height transition. Reduced-motion preferences also disable that transition.
Emoji and dictation
SpeechRecognition / webkitSpeechRecognition API, without downloading a model through FLEX. Recognition starts only after clicking the button; clicking it again stops the session. Browser permission, microphone and recognition errors appear as status messages. A network error means the browser could not reach its recognition service; it does not establish that the device is offline. Read-only and disabled fields cannot be modified by either tool.
Custom icons accept a Blade icon name, backed enum, Htmlable value or closure:
Toolbar selects
toolbarSelect() uses the shared FLEX Select engine with the textarea’s pill trigger. It supports keyboard navigation, RTL, adaptive dropdown positioning and instance-owned cleanup. The target path is relative to the textarea’s form container.
Declare a companion field to persist and validate the selected value. The dropdown alone does not create a database column or register a second form field.
Actions
toolbarAction() and toolbarActions() accept native Filament actions; the latter also accepts action groups. submitAction() places an action on the right side of the toolbar. It is disabled for empty or whitespace-only text, read-only/disabled fields, or an explicitly disabled action. Its loading target belongs to that field’s action.
prefixAction(), prefixActions(), suffixAction() and suffixActions(). Actions do not automatically submit or persist the surrounding form; configure that behavior in the action.
Configuration
Inherited Filament configuration includes
autosize(), rows(), cols(), placeholder(), autocomplete(), required(), minLength(), maxLength(), rules(), readOnly(), disabled(), trim() and state-binding modifiers such as live() or live(onBlur: true).
State and validation
The field enforces a server-side string rule in addition to configured native rules. Arrays, booleans and numeric forged state are rejected by form validation. Length, required rules and application authorization still run on the server; toolbar controls do not replace them. Whitespace and line breaks are preserved by default. Usetrim() to remove leading/trailing whitespace during dehydration. An optional empty value may be null. No JSON cast is needed for ordinary text.
The counter updates locally without waiting for a request and counts Unicode code points. Browser maxlength uses UTF-16 units, so emoji can consume more than one unit of the native input limit. The server remains authoritative for submitted text validation.
Runtime and performance
The nativewire:model binding owns text synchronization; the counter and tools do not send a duplicate state update. Autosizing reuses one measuring element per active instance and groups measurements into animation frames. Width changes and font loading trigger remeasurement; the field’s own height animation does not repeatedly trigger it.
Emoji code loads on demand. Shared Select assets are requested only by instances with toolbar selects. Watchers, listeners, measurement nodes, animation frames and recognition sessions are disposed with the field. Inactive tabs and closed modals follow the package’s normal activation lifecycle.
Variants
Playground
Open theflex-textarea page in your panel’s FLEX playground. Its Code Example tab contains counter, fixed-height, emoji/dictation, validated toolbar-select and action examples.
CSS reference
Related: Flex Text Input, Voice Note Recorder and Rich Editor.