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 tags input component allows you to interact with a list of tags.
Basic Usage
use Filament\Forms\Components\TagsInput;
TagsInput::make('tags')
Available Methods
Stores tags as separated string instead of JSON.TagsInput::make('tags')
->separator(',')
Adds autocomplete suggestions.TagsInput::make('tags')
->suggestions([
'tailwindcss',
'alpinejs',
'laravel',
'livewire',
])
Sets keys that create new tags.TagsInput::make('tags')
->splitKeys(['Tab', ' '])
Adds prefix to displayed tags.TagsInput::make('hashtags')
->tagPrefix('#')
Adds suffix to displayed tags.TagsInput::make('percentages')
->tagSuffix('%')
Allows reordering tags.TagsInput::make('tags')
->reorderable()
Sets the color of tags.TagsInput::make('tags')
->color('primary')
Trims whitespace from tags.TagsInput::make('tags')
->trim()
Adds validation rules for each tag.TagsInput::make('tags')
->nestedRecursiveRules([
'min:3',
'max:255',
])
Common Patterns
Blog Post Tags
TagsInput::make('tags')
->suggestions([
'laravel',
'php',
'javascript',
'vue',
'react',
])
->color('primary')
TagsInput::make('hashtags')
->tagPrefix('#')
->splitKeys(['Tab', ' ', ','])
->nestedRecursiveRules(['alpha_dash'])
Keywords
TagsInput::make('keywords')
->reorderable()
->separator(',')
->trim()
Categories
TagsInput::make('categories')
->suggestions([
'Technology',
'Business',
'Science',
'Health',
])
->color('success')
Database Casting
For JSON storage, add an array cast:
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
protected function casts(): array
{
return [
'tags' => 'array',
];
}
}