Skip to main content
← Back to Table of Contents

Summary

SaaS-style multi-select checklist. Same row layout as FlexRadiolist but stores an array of selected keys.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\FlexChecklist
State typelist<string|int> — selected option keys
FieldTypeflex_checklist
State castOptionsArrayStateCast

Basic usage

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

FlexChecklist::make('features')
    ->label('Included features')
    ->options([
        'wifi' => 'Wi‑Fi',
        'parking' => [
            'label' => 'Parking',
            'description' => 'On-site parking included',
            'icon' => 'heroicon-o-truck',
        ],
    ])
    ->minSelections(1)
    ->maxSelections(3)
    ->color('primary');

FlexChecklist::make('permissions')
    ->options(['read' => 'Read', 'write' => 'Write', 'admin' => 'Admin'])
    ->exactSelections(2)
    ->disabledOptions(['admin']);

State format

Array of unique string keys. Default: []. Duplicate values are deduplicated on validation.

Validation

RuleDetail
arrayState must be an array
Option keysEach value must exist in options()
exactSelections(n)Exactly n items selected
minSelections(n)At least n items
maxSelections(n)At most n items
required()Implies minSelections(1) when no explicit min

Configuration API

options(array|Closure $options)

key => label or rich array (label, description, desc, icon, disabled). From HasChecklistOptions.
FlexChecklist::make('field_name')
    ->options([
        'option_1' => 'Option 1',
        'option_2' => 'Option 2',
    ]);

icons(array|Closure $icons)

Per-key icon map merged into options.
FlexChecklist::make('field_name')
    ->icons([
        'option_1' => 'heroicon-o-star',
        'option_2' => 'heroicon-o-heart',
    ]);

descriptions(array|Closure $descriptions)

Per-key description map. Config key desc also supported.
FlexChecklist::make('field_name')
    ->descriptions(['value1', 'value2']);

disabledOptions(array|Closure $keys)

Keys rendered locked with lock icon.
FlexChecklist::make('field_name')
    ->disabledOptions(['option_2']);

size(string|ControlSize|Closure $size)

sm, md (default), lg.
FlexChecklist::make('field_name')
    ->size('md');

color(string|Closure|null $color)

Filament color for selected rows. Default: primary.
FlexChecklist::make('field_name')
    ->color('primary');

minSelections(int|Closure|null $count)

Minimum selections. null = no minimum (unless required()).
FlexChecklist::make('field_name')
    ->minSelections(10);

maxSelections(int|Closure|null $count)

Maximum selections.
FlexChecklist::make('field_name')
    ->maxSelections(10);

exactSelections(int|Closure|null $count)

Exact count; overrides min/max semantics when set.
FlexChecklist::make('field_name')
    ->exactSelections(10);

Public helper methods

MethodReturnsDescription
getColor()string|nullAccent color
getLockIcon()string|BackedEnum|HtmlableLock icon for disabled rows
getMinSelections()int|nullMin count
getMaxSelections()int|nullMax count
getExactSelections()int|nullExact count
getOptionKeys()listValid keys
getNormalizedOptions()arrayMerged option metadata
getDisabledOptions()arrayDisabled keys
isOptionDisabled(string|int $key)boolRow disabled
getChecklistSizeStyles()arrayCSS custom properties
getWrapperClasses()list<string>fff-flex-checklist

FlexField schema config

Config keyMaps to
optionsoptions()
iconsicons()
descriptions / descdescriptions()
disabled_optionsdisabledOptions()
sizesize()
colorcolor()
min_selectionsminSelections()
max_selectionsmaxSelections()
exact_selectionsexactSelections()

CSS classes

ClassRole
fff-flex-checklistRoot wrapper
fff-flex-checklist--{sm|md|lg}Size modifier
fff-flex-checklist__rowOption row
fff-flex-checklist__indicatorCheckbox indicator

Implementation notes

  • Pair with live() + afterStateUpdated() for autosave patterns (same as FlexRadiolist).
  • Locked options show getLockIcon() and cannot be toggled.