Skip to main content
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

Autosizing is enabled by default. Above the maximum height, the text area scrolls internally. Set 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

Emoji uses the same picker as Flex Text Input. Its dropdown anchors to the whole textarea shell, respects RTL and adapts to narrow screens. Emoji is inserted at the current text selection through a native input event. Failed picker loading retains a retry path. Dictation uses browser speech recognition and appends the transcript to the existing text. The microphone button is present from the first server render, so initialization does not insert it later or shift the toolbar. Where speech recognition is unavailable, it remains disabled with an explanatory label. Recognition uses only the native 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.
Multiple calls add multiple selects. Options and placeholder may be closures. Application actions that use this state must validate the form and enforce their own authorization.

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.
Native prefix/suffix APIs remain available: 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. Use trim() 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 native wire: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 the flex-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.
Last modified on October 16, 2026