Customization: Row Actions - Datatables for Laravel                  [               Datatables for Laravel  ](/) 

  Toggle main menu         [Docs](https://laravel-datatables.com/docs) [Demos](/demos) [Blog](https://laravel-datatables.com/blog) [Pricing](/pricing)        Search  ⌘ K   [ Log in ](/login) 

  [Docs](https://laravel-datatables.com/docs) [Demos](/demos) [Blog](https://laravel-datatables.com/blog) [Pricing](/pricing) 

 Search docs and demos  

Type at least 2 characters to search.

    Documentation menu      ### Getting Started

- [ Installation ](https://laravel-datatables.com/docs)
- [ Dark Mode ](https://laravel-datatables.com/docs/dark-mode)

### Basics

- [ Creating a Table ](https://laravel-datatables.com/docs/creating-a-table)
- [ Displaying Columns ](https://laravel-datatables.com/docs/displaying-columns)
- [ Data Sources ](https://laravel-datatables.com/docs/data-sources)
- [ Internationalisation ](https://laravel-datatables.com/docs/internationalisation)
- [ Multi-Language ](https://laravel-datatables.com/docs/multi-language)
- [ Styling ](https://laravel-datatables.com/docs/styling)

### Customization

- [ Columns ](https://laravel-datatables.com/docs/customization-columns)
- [ Cell Renderer ](https://laravel-datatables.com/docs/customization-cell-renderer)
- [ Value Formatter ](https://laravel-datatables.com/docs/customization-value-formatter)
- [ Filters ](https://laravel-datatables.com/docs/customization-filters)
- [ Pagination ](https://laravel-datatables.com/docs/customization-pagination)
- [ Sorting Icons ](https://laravel-datatables.com/docs/customization-sorting-icons)
- [ Row Actions ](https://laravel-datatables.com/docs/customization-row-actions)
- [ Multi Row Actions ](https://laravel-datatables.com/docs/customization-multi-row-actions)
- [ Loading Indicator ](https://laravel-datatables.com/docs/customization-loading-indicator)
- [ Exporting ](https://laravel-datatables.com/docs/customization-exporting)
- [ Components ](https://laravel-datatables.com/docs/customization-components)
- [ Data Sources ](https://laravel-datatables.com/docs/customization-data-sources)
- [ State Persistence ](https://laravel-datatables.com/docs/customization-state-persistence)

### Features

- [ Accessibility ](https://laravel-datatables.com/docs/feature-accessibility)
- [ Actions and Forms ](https://laravel-datatables.com/docs/actions-and-forms)
- [ Aggregate Columns ](https://laravel-datatables.com/docs/feature-aggregate-columns)
- [ Column Reordering ](https://laravel-datatables.com/docs/feature-column-reordering)
- [ Column Visibility ](https://laravel-datatables.com/docs/feature-column-visibility)
- [ Custom Filters ](https://laravel-datatables.com/docs/feature-custom-filters)
- [ Custom Controls ](https://laravel-datatables.com/docs/feature-custom-controls)
- [ Exporting ](https://laravel-datatables.com/docs/feature-exporting)
- [ Freeze Columns and Headers ](https://laravel-datatables.com/docs/feature-freeze-columns-and-headers)
- [ Pagination ](https://laravel-datatables.com/docs/feature-pagination)
- [ Responsive Mobile ](https://laravel-datatables.com/docs/feature-responsive-mobile)
- [ Row Grouping ](https://laravel-datatables.com/docs/feature-row-grouping)
- [ Row Selection ](https://laravel-datatables.com/docs/feature-row-selection)
- [ Sorting and Searching ](https://laravel-datatables.com/docs/sorting-and-searching)
- [ State Persistence ](https://laravel-datatables.com/docs/feature-state-persistence)
- [ Value Preparation ](https://laravel-datatables.com/docs/feature-value-preparation)

### Cell Renderer

- [ Action Buttons ](https://laravel-datatables.com/docs/renderer-action-buttons)
- [ Avatar ](https://laravel-datatables.com/docs/renderer-avatar)
- [ Checkmark ](https://laravel-datatables.com/docs/renderer-checkmark)
- [ Color Sample ](https://laravel-datatables.com/docs/renderer-color-sample)
- [ Email Link ](https://laravel-datatables.com/docs/renderer-email-to-link)
- [ External Link ](https://laravel-datatables.com/docs/renderer-external-link)
- [ Friendly Timestamp ](https://laravel-datatables.com/docs/renderer-friendly-timestamp)
- [ Image ](https://laravel-datatables.com/docs/renderer-image)
- [ Long Text ](https://laravel-datatables.com/docs/renderer-long-text)
- [ Phone Link ](https://laravel-datatables.com/docs/renderer-phone-link)
- [ Progress Bar ](https://laravel-datatables.com/docs/renderer-progress-bar)
- [ Status Badge ](https://laravel-datatables.com/docs/renderer-status-badge)
- [ URL Link ](https://laravel-datatables.com/docs/renderer-url-link)
- [ Wire Link ](https://laravel-datatables.com/docs/renderer-wire-link)

### Value Formatter

- [ Compact Number ](https://laravel-datatables.com/docs/formatter-compact-number)
- [ Currency ](https://laravel-datatables.com/docs/formatter-currency)
- [ Duration ](https://laravel-datatables.com/docs/formatter-duration)
- [ Friendly Filesize ](https://laravel-datatables.com/docs/formatter-friendly-filesize)
- [ Friendly Timestamp ](https://laravel-datatables.com/docs/formatter-friendly-timestamp)
- [ Locale Timestamp ](https://laravel-datatables.com/docs/formatter-locale-timestamp)
- [ Number ](https://laravel-datatables.com/docs/formatter-number)
- [ Percent ](https://laravel-datatables.com/docs/formatter-percent)

  Row Actions
===========

Row actions combine an action renderer with Datatable action hooks. The package invokes onRowAction via the ActionButtons renderer and routes to handleRowAction().

1. What ActionButtons Includes By Default
-----------------------------------------

ActionButtons renders three row actions by default: view, edit, and delete. They are all enabled unless you provide a custom actions list or resolver.

 Default three actions PHP     `Column::make('actions', __('Actions'))    ->functional()    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(variant: 'icon'));` 

 ```
Column::make('actions', __('Actions'))
    ->functional()
    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(variant: 'icon'));
```

2. ActionButtons Constructor Arguments
--------------------------------------

Use constructor arguments to control labels, actions, icon overrides, and per-row action resolution.

 Constructor signature PHP     `new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(    variant: 'text', // text | button | icon (verbal maps to text)    viewLabel: 'datatable.actions.view',    editLabel: 'datatable.actions.edit',    deleteLabel: 'datatable.actions.delete',    actions: [        'view',        ['action' => 'backup', 'label' => 'datatable.actions.backup'],    ],    actionsResolver: fn ($row) => [        ['action' => 'view', 'label' => 'datatable.actions.view'],        data_get($row, 'deleted_at')            ? ['action' => 'restore', 'label' => 'datatable.actions.restore']            : ['action' => 'delete', 'label' => 'datatable.actions.delete'],    ],    iconOverrides: [        'backup' => '',        'restore' => '',    ]);` 

 ```
new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(
    variant: 'text', // text | button | icon (verbal maps to text)
    viewLabel: 'datatable.actions.view',
    editLabel: 'datatable.actions.edit',
    deleteLabel: 'datatable.actions.delete',
    actions: [
        'view',
        ['action' => 'backup', 'label' => 'datatable.actions.backup'],
    ],
    actionsResolver: fn ($row) => [
        ['action' => 'view', 'label' => 'datatable.actions.view'],
        data_get($row, 'deleted_at')
            ? ['action' => 'restore', 'label' => 'datatable.actions.restore']
            : ['action' => 'delete', 'label' => 'datatable.actions.delete'],
    ],
    iconOverrides: [
        'backup' => '',
        'restore' => '',
    ]
);
```

3. Renderer \_\_invoke Parameters
---------------------------------

The renderer method is \_\_invoke($value, $row).

 Parameter meaning TEXT     `$value: current cell value for the actions column (often null/unused).$row: full row payload. ActionButtons resolves row['id'] (or data_get($row, 'id')) for wire callbacks.` 

 ```
$value: current cell value for the actions column (often null/unused).
$row: full row payload. ActionButtons resolves row['id'] (or data_get($row, 'id')) for wire callbacks.
```

4. Variant Examples
-------------------

Use one of these renderer variants depending on UX requirements.

 Text-based actions PHP     `Column::make('actions', __('Actions'))    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(        variant: 'text',        viewLabel: __('View'),        editLabel: __('Edit'),        deleteLabel: __('Delete')    ));` 

 ```
Column::make('actions', __('Actions'))
    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(
        variant: 'text',
        viewLabel: __('View'),
        editLabel: __('Edit'),
        deleteLabel: __('Delete')
    ));
```

 Button with label PHP     `Column::make('actions', __('Actions'))    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(        variant: 'button',        viewLabel: 'datatable.actions.open',        editLabel: 'datatable.actions.update',        deleteLabel: 'datatable.actions.remove'    ));` 

 ```
Column::make('actions', __('Actions'))
    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(
        variant: 'button',
        viewLabel: 'datatable.actions.open',
        editLabel: 'datatable.actions.update',
        deleteLabel: 'datatable.actions.remove'
    ));
```

 Icon with tooltip/aria label PHP     `Column::make('actions', __('Actions'))    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(        variant: 'icon',        viewLabel: __('View'),        editLabel: __('Edit'),        deleteLabel: __('Delete'),        iconOverrides: [            'view' => '',            'edit' => '',            'delete' => '',        ]    ));` 

 ```
Column::make('actions', __('Actions'))
    ->renderer(new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(
        variant: 'icon',
        viewLabel: __('View'),
        editLabel: __('Edit'),
        deleteLabel: __('Delete'),
        iconOverrides: [
            'view' => '',
            'edit' => '',
            'delete' => '',
        ]
    ));
```

5. Multiple Actions and Conditional Actions
-------------------------------------------

You can include any number of action buttons and switch actions by row state.

 Soft-delete aware delete/restore PHP     `Column::make('actions', __('Actions'))->functional()->renderer(    new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(        variant: 'button',        actionsResolver: function ($row): array {            $actions = [                ['action' => 'view', 'label' => __('View')],                ['action' => 'edit', 'label' => __('Edit')],            ];            if (data_get($row, 'deleted_at')) {                $actions[] = ['action' => 'restore', 'label' => __('Restore')];            } else {                $actions[] = ['action' => 'delete', 'label' => __('Delete')];            }            return $actions;        }    ));` 

 ```
Column::make('actions', __('Actions'))->functional()->renderer(
    new \MorrowIt\LaravelDatatable\Renderers\ActionButtons(
        variant: 'button',
        actionsResolver: function ($row): array {
            $actions = [
                ['action' => 'view', 'label' => __('View')],
                ['action' => 'edit', 'label' => __('Edit')],
            ];

            if (data_get($row, 'deleted_at')) {
                $actions[] = ['action' => 'restore', 'label' => __('Restore')];
            } else {
                $actions[] = ['action' => 'delete', 'label' => __('Delete')];
            }

            return $actions;
        }
    )
);
```

6. Provide Your Own ActionButton Renderer
-----------------------------------------

Any renderer implementing RendererInterface can be used in the actions column. This is the extension point for fully custom Backup/Restore components.

 Custom row action renderer class PHP     `namespace App\Datatables\Renderers;use MorrowIt\LaravelDatatable\Contracts\RendererInterface;class BackupRestoreButtons implements RendererInterface{    public function __invoke($value, $row)    {        $id = data_get($row, 'id');        if (!$id) {            return '';        }        $isDeleted = (bool) data_get($row, 'deleted_at');        return view('components.datatable.backup-restore-actions', [            'id' => $id,            'isDeleted' => $isDeleted,        ])->render();    }}` 

 ```
namespace App\Datatables\Renderers;

use MorrowIt\LaravelDatatable\Contracts\RendererInterface;

class BackupRestoreButtons implements RendererInterface
{
    public function __invoke($value, $row)
    {
        $id = data_get($row, 'id');

        if (!$id) {
            return '';
        }

        $isDeleted = (bool) data_get($row, 'deleted_at');

        return view('components.datatable.backup-restore-actions', [
            'id' => $id,
            'isDeleted' => $isDeleted,
        ])->render();
    }
}
```

 Use custom renderer PHP     `Column::make('actions', __('Actions'))    ->functional()    ->renderer(new \App\Datatables\Renderers\BackupRestoreButtons());` 

 ```
Column::make('actions', __('Actions'))
    ->functional()
    ->renderer(new \App\Datatables\Renderers\BackupRestoreButtons());
```

7. Action Hook in Datatable Class
---------------------------------

The package calls handleRowAction(string $rowId, string $action).

 handleRowAction PHP     `protected function handleRowAction(string $rowId, string $action): void{    if ($action === 'view') {        $this->redirectRoute('products.show', ['product' => $rowId]);        return;    }    if ($action === 'edit') {        $this->redirectRoute('products.edit', ['product' => $rowId]);        return;    }    if ($action === 'delete') {        // Add confirmation and delete workflow.        return;    }    if ($action === 'restore') {        // Restore soft-deleted record.        return;    }    if ($action === 'backup') {        // Trigger backup workflow.    }}` 

 ```
protected function handleRowAction(string $rowId, string $action): void
{
    if ($action === 'view') {
        $this->redirectRoute('products.show', ['product' => $rowId]);
        return;
    }

    if ($action === 'edit') {
        $this->redirectRoute('products.edit', ['product' => $rowId]);
        return;
    }

    if ($action === 'delete') {
        // Add confirmation and delete workflow.
        return;
    }

    if ($action === 'restore') {
        // Restore soft-deleted record.
        return;
    }

    if ($action === 'backup') {
        // Trigger backup workflow.
    }
}
```

Always authorize row actions server-side, even if the action button is hidden in UI for certain users.

For destructive actions, add confirmation and idempotency safeguards to prevent accidental repeated execution.

   © 2026 Copyright (C)  [ Morrow IT Consulting &amp; Services ](https://morrow-it.services)  

 [Terms of Service](https://laravel-datatables.com/legal/terms) [Privacy](https://laravel-datatables.com/legal/privacy) [Legal Disclosure](https://laravel-datatables.com/legal/disclosure)
