Disable option Checkbox List more than 1 items
In the example above, we can disable the
livewire optionsMy question is, how to disable
livewire and laravel in options?livewirelivewirelaravel$set('technologies', ['special-option']);use Filament\Forms\Components\CheckboxList;
CheckboxList::make('technologies')
->options([
'tailwind' => 'Tailwind CSS',
'alpine' => 'Alpine.js',
'laravel' => 'Laravel',
'livewire' => 'Laravel Livewire',
])
->disableOptionWhen(fn (string $value): bool => $value === 'livewire')->disableOptionWhen(function (string $value, $state): bool {
$tempData = $state ?? [];
$founSpecialOption = in_array('special-option', $tempData);
if($founSpecialOption) {
$set('technologies', ['special-option']);
return
$value === 'tailwind' || $value === 'alpine' || $value === 'laravel' || $value === 'livewire';
} else {
return false;
}
}),