Skip to main content
FlexTextareaField ← Back to Table of Contents

Summary

SaaS-style multi-line textarea with optional toolbar, autosize, emoji picker, and speech dictation. Extends Filament Textarea.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\FlexTextareaField
ExtendsFilament\Forms\Components\Textarea
State typestring|null
FieldTypeflex_textarea

Basic usage

use Bjanczak\FilamentFlexFields\Filament\Forms\Components\FlexTextareaField;
use Filament\Actions\Action;
use Filament\Support\Icons\Heroicon;

FlexTextareaField::make('message')
    ->label('Message')
    ->placeholder('Write something…')
    ->maxLength(500)
    ->characterCounter()
    ->emojiPicker()
    ->speechDictation()
    ->footer('Markdown supported')
    ->toolbarSelect(
        'model',
        ['claude-4.6-opus' => 'Claude 4.6 Opus', 'gpt-5' => 'GPT-5'],
        icon: Heroicon::CpuChip,
    )
    ->toolbarAction(
        Action::make('bold')->icon(Heroicon::Bold)->action(fn () => null),
    )
    ->submitAction(
        Action::make('send')->icon(Heroicon::PaperAirplane)->color('primary'),
    );

Layout

  • Rounded shell with autosizing textarea
  • Optional toolbar row: emoji, prefix actions, toolbar selects, suffix actions (e.g. Send)
  • Optional footer text and character counter
  • Default textarea content is server-rendered for instant display on page load

Custom configuration API

Caching actions

Improves rendering performance by caching prefix and suffix action definitions:
FlexTextareaField::make('body')
    ->cachePrefixActions()
    ->cacheSuffixActions();

Icon overrides

Override trigger icons for toolbar actions:
FlexTextareaField::make('body')
    ->emojiPicker()
    ->speechDictation()
    ->emojiIcon('heroicon-o-face-smile')
    ->microphoneIcon('heroicon-o-microphone');

Inherited Textarea API

Includes rows(), cols(), autosize(), disableGrammarly(), maxLength(), minLength(), live(), and all standard Filament Field methods. Default setup calls autosize(), rows(1), and disableGrammarly().

FlexField schema config

Config keyMaps to
sizesize()
variantvariant()
character_countercharacterCounter()
animated_autosizeanimatedAutosize()
max_heightmaxHeight()
footerfooter()
rowsrows()
max_lengthmaxLength()
speech_dictationspeechDictation()
speech_dictation_languagespeechDictationLanguage()
emoji_pickeremojiPicker()
emoji_picker_localeemojiPickerLocale()
speech_dictation_labelspeechDictationLabel()
emoji_picker_labelemojiPickerLabel()
Toolbar selects, toolbar actions, and submitAction() are not configurable via FlexFieldFormBuilder — use the fluent API in PHP.

Public helper methods

MethodReturnsDescription
getInitialHeightRem()floatServer-rendered initial textarea height in rem from rows() (formula: max(rows × 1.5 + 0.25, 2.25)).
getToolbarSelects()list<array<statePath, options, placeholder, icon, initialValue, initialLabel>>Resolved toolbar dropdown configs with server-rendered initial labels.
isSubmitDisabled()boolWhether the submit action should be disabled (trimmed state is blank).