FilamentF
Filament3y ago
Hugo

Collapse all previous repeater items on addAction

Hi,

On my repeater, what can I do so that when I click on the button to add an item, all previous items become collapsed?
I can't find a solution in the documentation

Forms\Components\Repeater::make('services')
     ->label('Services')
     ->hintIcon('heroicon-o-information-circle', 'Ignorez cette étape si vous ne souhaitez pas associer de service au bénévole.')
     ->hintColor('primary')
     ->addActionLabel('Ajouter un service au bénévole')
     ->reorderableWithDragAndDrop(false)
     ->collapsible()
     ->defaultItems(0)
     ->itemLabel(fn(array $state): ?string => Service::find($state['service_id'])->serviceType->name ?? null)
     ->deleteAction(fn(Action $action) => $action->requiresConfirmation())
     ->schema([...]),


Thanks for your help.
Was this page helpful?