majid-shafik / filament-table-drag-scroll
Grab and drag horizontally scrollable Filament tables with a mouse.
Package info
github.com/Majid-Shafik/filament-table-drag-scroll
Language:JavaScript
pkg:composer/majid-shafik/filament-table-drag-scroll
Requires
- php: ^8.2
- filament/filament: ^5.0
- spatie/laravel-package-tools: ^1.15
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Grab and drag horizontally scrollable Filament tables with a mouse. The package works with Filament panels and standalone tables, including RTL layouts, Livewire updates, and SPA navigation.
Features
- Automatically detects horizontally scrollable Filament tables.
- Uses native Pointer Events and the primary mouse button.
- Preserves links, buttons, inputs, sorting, and reordering controls.
- Prevents accidental row clicks after a real drag.
- Cancels when the gesture is primarily vertical.
- Requires no JavaScript build step and does not modify Filament vendor files.
Requirements
- PHP 8.2 or newer.
- Filament 5.x.
Installation
Install the package through Composer:
composer require majid-shafik/filament-table-drag-scroll
Publish Filament assets, then refresh the browser:
php artisan filament:assets
No panel provider changes are required. The package is enabled automatically through Laravel package discovery.
Configuration
The defaults work for standard Filament tables. To customize them, publish the config file:
php artisan vendor:publish --tag="filament-table-drag-scroll-config"
You may disable the behavior, change the drag threshold, or add selectors that must remain interactive:
return [ 'enabled' => true, 'drag_threshold' => 6, 'excluded_selectors' => [ 'a', 'button', 'input', 'select', 'textarea', 'label', '[contenteditable="true"]', '[draggable="true"]', '[role="button"]', '[x-sortable-handle]', '.fi-ta-reorder-handle', ], ];
After changing package assets, run php artisan filament:assets again.
Testing
composer test
composer test:lint
composer analyse
node --check resources/js/table-drag-scroll.js
Changelog
See CHANGELOG.md for release history.
Security
Please report security issues privately as described in SECURITY.md.
License
The MIT License. See LICENSE.md.
