actions
Column header actions
Add per-column buttons such as create, with the column status pre-filled.
Column header actions run per column. The common case is a create button that pre-fills the status
of the column it sits in — the column's status arrives in $arguments['status'].
Create action
Use the kanban's CreateAction (not Filament's) so new cards get a position when reordering is
enabled:
use Asmit\AdvancedKanban\Actions\CreateAction;
use Filament\Support\Icons\Heroicon;
CreateAction::make()
->schema(function (array $arguments): array {
return $this->taskForm($arguments['status']);
})
->icon(Heroicon::OutlinedPlus)
->link()
When reordering is enabled, this action also fills
the order field, so a new card lands at the bottom of the column it was created in. It resolves
the column from the status form field, or from the column header the button sits under.
Registering header actions
<?php
use Filament\Actions\Action;
public function kanban(Kanban $kanban): Kanban
{
return $kanban
->model(Task::class)
->statusField('status')
->columns([
// Your columns here
])
->columnHeaderActions([
Action::make('add_task')
->label('Add Task')
->icon('heroicon-o-plus')
->color('primary')
->action(function ($arguments) {
// $arguments contains the current column status
$this->addTaskToColumn($arguments['status']);
}),
]);
}
See also
- Overview — record actions vs column header actions
- Action groups — grouped header actions
- Card reordering — position handling for new records