Documentation Index
Fetch the complete documentation index at: https://mintlify.com/filamentphp/filament/llms.txt
Use this file to discover all available pages before exploring further.
The text input component allows you to interact with a string value.
Basic Usage
use Filament\Forms\Components\TextInput;
TextInput::make('name')
Available Methods
Sets the input type to email and adds email validation.TextInput::make('email')
->email()
Sets the input type to numeric and adds numeric validation.TextInput::make('price')
->numeric()
Sets the input type to integer and adds integer validation.TextInput::make('quantity')
->integer()
Sets the input type to password.TextInput::make('password')
->password()
Sets the input type to tel and adds phone number validation.TextInput::make('phone')
->tel()
Sets the input type to URL and adds URL validation.TextInput::make('website')
->url()
Sets a custom HTML input type.TextInput::make('color')
->type('color')
Applies an input mask using Alpine.js.use Filament\Support\RawJs;
TextInput::make('birthday')
->mask('99/99/9999')
->placeholder('MM/DD/YYYY')
TextInput::make('cardNumber')
->mask(RawJs::make('$input.startsWith("34") ? "9999 999999 99999" : "9999 9999 9999 9999"'))
Adds text before the input.TextInput::make('domain')
->prefix('https://')
Adds text after the input.TextInput::make('domain')
->suffix('.com')
Adds an icon before the input.use Filament\Support\Icons\Heroicon;
TextInput::make('email')
->prefixIcon(Heroicon::Envelope)
Adds an icon after the input.use Filament\Support\Icons\Heroicon;
TextInput::make('website')
->suffixIcon(Heroicon::GlobeAlt)
Sets the color of the prefix icon.TextInput::make('email')
->prefixIcon(Heroicon::Envelope)
->prefixIconColor('primary')
Sets the color of the suffix icon.TextInput::make('status')
->suffixIcon(Heroicon::CheckCircle)
->suffixIconColor('success')
Makes password inputs revealable with a toggle button.TextInput::make('password')
->password()
->revealable()
Adds a copy-to-clipboard button.TextInput::make('apiKey')
->copyable(copyMessage: 'Copied!', copyMessageDuration: 1500)
Adds datalist autocomplete options.TextInput::make('manufacturer')
->datalist(['BMW', 'Ford', 'Mercedes-Benz', 'Toyota'])
Sets the autocomplete attribute.TextInput::make('password')
->password()
->autocomplete('new-password')
Sets the autocapitalize attribute.TextInput::make('name')
->autocapitalize('words')
Sets the inputmode attribute.TextInput::make('amount')
->numeric()
->inputMode('decimal')
Sets the step attribute for numeric inputs.TextInput::make('price')
->numeric()
->step(0.01)
Sets the minimum value for numeric inputs.TextInput::make('quantity')
->numeric()
->minValue(1)
Sets the maximum value for numeric inputs.TextInput::make('quantity')
->numeric()
->maxValue(100)
Sets the minimum length validation.TextInput::make('name')
->minLength(2)
Sets the maximum length validation.TextInput::make('name')
->maxLength(255)
Sets the exact length validation.TextInput::make('code')
->length(8)
Sets a custom regex for tel validation.TextInput::make('phone')
->tel()
->telRegex('/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\\/0-9]*$/')
Adds current password validation.TextInput::make('current_password')
->password()
->currentPassword()
Strips specific characters from the input.TextInput::make('amount')
->mask(RawJs::make('$money($input)'))
->stripCharacters(',')
->numeric()
Trims whitespace from the input.TextInput::make('name')
->trim()
Makes the input read-only.TextInput::make('slug')
->readOnly()
Sets the placeholder text.TextInput::make('name')
->placeholder('Enter your name')
Common Patterns
TextInput::make('email')
->email()
->required()
->maxLength(255)
TextInput::make('password')
->password()
->revealable()
->required()
->minLength(8)
TextInput::make('quantity')
->numeric()
->minValue(1)
->maxValue(100)
->default(1)
use Filament\Support\RawJs;
TextInput::make('price')
->prefix('$')
->numeric()
->minValue(0)
->step(0.01)
TextInput::make('phone')
->tel()
->maxLength(20)