Skip to main content
← Back to Table of Contents

Summary

Tag input featuring removable pill chips, optional static or server-side suggestions, and duplicate-insensitive matching. Extends Filament’s standard TagsInput with FlexTextInput styling, size/variant tokens, and optional Spatie Tags integration.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\TagsField
Spatie classBjanczak\FilamentFlexFields\Filament\Forms\Components\Spatie\FlexSpatieTagsField
State typelist<string> (array) or string (delimited)
FieldTypetags
Playgroundtags-field slug in Flex Fields playground

Basic usage

Standard Skills Input

use Bjanczak\FilamentFlexFields\Filament\Forms\Components\TagsField;

TagsField::make('skills')
    ->label('Skills')
    ->suggestions(['PHP', 'Laravel', 'Filament', 'Livewire'])
    ->maxTags(10)
    ->required();

Comma-Separated Labels

TagsField::make('labels')
    ->separator(',')
    ->placeholder('Add labels...')
    ->variant('secondary')
    ->size('sm');

State & validation

Stored value

By default, state is an ordered list of trimmed strings (JSON array). If separator() is set, it dehydrates as a delimited string.
$record->skills; // ['laravel', 'filament']
$record->labels; // 'php,pest,livewire' (with separator)

Validation rules (built-in)

BehaviourDetail
required()At least one tag must be present
maxTags()Caps the total number of tags
suggestionsOnly()Restricts input to suggestion values only
duplicateInsensitive()Case-insensitive duplicate check

Configuration API

All methods accept Closure unless noted.
MethodTypeDefaultDescription
variant(string $variant)Setupprimaryprimary, secondary, flat, soft
size(string $size)Setup'md'sm, md, lg
maxTags(int $max)SetupnullMaximum number of tags
suggestionsOnly(bool $cond)SetupfalseRestrict to suggestions only
duplicateInsensitive(bool $c)SetupfalseCase-insensitive duplicates
showTagCount(bool $cond)SetupfalseShow live counter below field
getSearchResultsUsing(Closure $cb)SetupAsync suggestion search
minSearchLength(int $len)Setup2Min chars for server search
type(string $type)SpatieSpatie tag type (Spatie class only)

Real-world examples

TagsField::make('technologies')
    ->getSearchResultsUsing(function (string $search): array {
        return Technology::query()
            ->where('name', 'like', "%{$search}%")
            ->limit(20)
            ->pluck('name')
            ->all();
    });

Spatie Tags Integration

use Bjanczak\FilamentFlexFields\Filament\Forms\Components\Spatie\FlexSpatieTagsField;

FlexSpatieTagsField::make('tags')
    ->type('categories')
    ->label('Categories');

Playground

/admin/flex-fields-playground/tags-field See Playground for setup.
ComponentWhen to use instead
SelectFieldMulti-select with fixed options
FlexChecklistGrid of checkbox choices
UserSelectSpecifically for selecting users

CSS classes (reference)

ClassRole
fff-tags-fieldRoot field wrapper
fff-tags-field--{sm|md|lg}Size variant
fff-tags-field--{variant}Visual variant
fff-flex-text-inputShared input shell
fi-color-{color}Pill color modifier
has-focus-outlineFocus ring active