essentials
Actions
Create, edit, and delete records from a card, and add actions to column headers.
Record actions
Create
use Asmit\AdvancedKanban\RecordAction\CreateAction;
CreateAction::make('create')
->schema([
// Component schema here
])
Edit
use Asmit\AdvancedKanban\RecordAction\EditAction;
EditAction::make('edit')
->schema([
// Component schema here
])
Delete
use Asmit\AdvancedKanban\RecordAction\DeleteAction;
DeleteAction::make('delete')
->icon(Heroicon::OutlinedTrash)
->requiresConfirmation()
->color('danger')
Attaching them to cards
<?php
use Asmit\AdvancedKanban\Kanban;
use Asmit\AdvancedKanban\RecordAction\Action;
use Asmit\AdvancedKanban\RecordAction\DeleteAction;
use Asmit\AdvancedKanban\RecordAction\EditAction;
public function kanban(Kanban $kanban): Kanban
{
return $kanban
->model(Task::class)
->statusField('status')
->recordActions([
EditAction::make('edit')
->model(Task::class)
->schema([
// Component schema here
]),
DeleteAction::make('delete')
->icon(Heroicon::OutlinedTrash)
->requiresConfirmation()
->color('danger'),
Action::make('view')
->label('View')
->icon('heroicon-o-eye')
->action(fn($record) => $this->viewTask($record))
->openUrlInNewTab(),
])
->columns([
// Your columns here
]);
}
Action groups
Collapse secondary actions behind a menu so the card stays readable:
use Asmit\AdvancedKanban\Actions\ActionGroup;
use Asmit\AdvancedKanban\RecordAction\Action;
use Asmit\AdvancedKanban\RecordAction\DeleteAction;
public function kanban(Kanban $kanban): Kanban
{
return $kanban
->model(Task::class)
->statusField('status')
->recordActions([
Action::make('edit')
->label('Edit')
->icon('heroicon-o-pencil')
->action(fn($record) => $this->editTask($record)),
ActionGroup::make([
Action::make('view')
->label('View Details')
->icon('heroicon-o-eye')
->action(fn($record) => $this->viewTask($record)),
Action::make('duplicate')
->label('Duplicate')
->icon('heroicon-o-document-duplicate')
->action(fn($record) => $this->duplicateTask($record)),
DeleteAction::make('delete')
->label('Delete')
->icon('heroicon-o-trash')
->color('danger')
->action(fn($record) => $this->deleteTask($record)),
])
->label('More Actions')
->icon('heroicon-o-ellipsis-vertical')
->dropdownPlacement('bottom-end'),
])
->columns([
// Your columns here
]);
}
Column header actions
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'].
use Asmit\AdvancedKanban\Actions\CreateAction;
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.
Register them with columnHeaderActions():
<?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']);
}),
]);
}
Grouped header actions
use Asmit\AdvancedKanban\Actions\ActionGroup;
use Filament\Actions\Action;
public function kanban(Kanban $kanban): Kanban
{
return $kanban
->model(Task::class)
->statusField('status')
->columns([
// Your columns here
])
->columnHeaderActions([
ActionGroup::make([
Action::make('add_task')
->label('Add Task')
->icon('heroicon-o-plus')
->action(fn($arguments) => $this->addTask($arguments['status'])),
Action::make('bulk_edit')
->label('Bulk Edit')
->icon('heroicon-o-pencil')
->action(fn($arguments) => $this->bulkEdit($arguments['status'])),
Action::make('export_column')
->label('Export Column')
->icon('heroicon-o-arrow-down-tray')
->action(fn($arguments) => $this->exportColumn($arguments['status'])),
])
->label('More Actions')
->icon('heroicon-o-ellipsis-vertical')
->color('gray'),
]);
}