Skip to content

πŸ”§ KanbanColumn Configuration Options ​

1. KanbanColumn Methods Overview ​

This section provides a complete reference of all available methods in the KanbanColumn class with their descriptions and parameters.

MethodDescriptionParameters
make()Create a new KanbanColumn instancestring $status
label()Set the display label for the columnstring|Closure $label
description()Set the column descriptionstring $description
icon()Set the column iconstring|Closure|ScalableIcon $icon
iconColor()Set the icon colorstring|Closure $color
hidden()Hide or show the columnbool|Closure $hidden = true
allowedTransitions()Set allowed status transitionsarray|Closure $transitions
lockCardUsing()Set card locking conditionstring|Closure $icon
lockedIcon()Set locked iconbool|Closure|ScalableIcon $icon = true
lockedLabel()Set locked labelstring|Closure $label = true
modifyRecordQueryUsing()Modify query for column recordsClosure $callback

2. Column Creation Methods ​

2.1 make(string $status) ​

Creates a new KanbanColumn instance with the specified status.

php
KanbanColumn::make('todo')
KanbanColumn::make('in-progress')
KanbanColumn::make('done')

3. Display Configuration Methods ​

3.1 label(string|Closure $label) ​

Sets the display label for the column. This is what users will see as the column header.

php
->label('To Do')
->label('In Progress')
->label('Under Review')
->label(fn() => 'Custom ' . ucfirst($this->status))

3.2 description(string $description) ​

Sets a description for the column that can be displayed as a tooltip or subtitle.

php
->description('Tasks that need to be started')
->description('Tasks currently being worked on')
->description('Completed tasks ready for review')

3.3 color(string|Closure $color) ​

Sets the color theme for the column. Can be a string or closure for dynamic colors.

php
->color('gray')
->color('blue')
->color('green')
->color('red')
->color(fn() => $this->status === 'urgent' ? 'red' : 'gray')

3.4 iconColor(string|Closure $color) ​

Sets the color for the column icon.

php
->iconColor('gray')
->iconColor('blue')
->iconColor(Heroicon::OutlinedRectangleStack)
->iconColor('red')
->iconColor(fn() => $this->status === 'urgent' ? 'red' : 'gray')

4. Visibility Configuration Methods ​

4.1 hidden(bool|Closure $hidden = true) ​

Hides or shows the column. Useful for conditional column display.

php
->hidden(true)  // Hide the column
->hidden(false) // Show the column
->hidden(fn() => auth()->user()->cannot('view-archived'))
->hidden(fn() => $this->status === 'archived' && !$showArchived)

5. Workflow Configuration Methods ​

5.1 allowedTransitions(array|Closure $transitions) ​

Sets which statuses records can transition to from this column. Controls drag-and-drop behavior.

php
// Simple array format
->allowedTransitions(['in-progress'])

// Multiple allowed transitions
->allowedTransitions(['in-progress', 'review'])

// No transitions allowed (final state)
->allowedTransitions([])

// Dynamic transitions based on conditions
->allowedTransitions(fn() => [
    'in-progress',
    auth()->user()->can('skip-review') ? 'done' : 'review'
])

// Complex workflow rules
->allowedTransitions(fn() => match($this->status) {
    'todo' => ['in-progress'],
    'in-progress' => ['review', 'todo'],
    'review' => ['done', 'in-progress'],
    'done' => ['review'],
    default => []
})

6. Card Behavior Configuration Methods ​

6.1 lockCardUsing(bool|Closure $condition = true) ​

Sets conditions for when cards in this column should be locked (prevented from moving).

php
// Lock all cards in this column
->lockCardUsing(true)

// Never lock cards in this column
->lockCardUsing(false)

// Lock cards based on record properties
->lockCardUsing(fn($record) => $record->priority === 'urgent')

6.2 lockedIcon(bool|Closure|ScalableIcon $icon = true) ​

Sets the icon for the locked state of the column.

php
->lockedIcon(Heroicon::OutlineLockClosed)
->lockedIcon(fn() => $this->status === 'urgent' ? Heroicon::OutlineLockClosed : Heroicon::OutlineLockOpen)

6.3 lockedLabel(bool|Closure|string $label = true) ​

Sets the label for the locked state of the column.

php
->lockedLabel('Locked')
->lockedLabel(fn() => $this->status === 'urgent' ? 'Urgently Locked' : 'Locked')

7. Query Modification Methods ​

7.1 modifyRecordQueryUsing(Closure $callback) ​

Allows you to modify the query for records in this specific column. Provides access to the query and column object.

php
// Filter records based on column status
$kanban->modifyRecordQueryUsing(function ($query, $column) {
    if ($column->getStatus() === 'urgent') {
        return $query->where('priority', 'high');
    }
    return $query;
})

// Add custom ordering for specific columns
$kanban->modifyRecordQueryUsing(function ($query, $column) {
    if ($column->getStatus() === 'done') {
        return $query->orderBy('completed_at', 'desc');
    }
    return $query->orderBy('created_at', 'asc');
})

// Apply column-specific filters
$kanban->modifyRecordQueryUsing(function ($query, $column) {
    if ($column->getStatus() === 'archived') {
        return $query->where('is_archived', true);
    }
    return $query->where('is_archived', false);
})

Released under the MIT License.