Download the PHP package hydrat/filament-table-layout-toggle without Composer
On this page you can find all versions of the php package hydrat/filament-table-layout-toggle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hydrat/filament-table-layout-toggle
More information about hydrat/filament-table-layout-toggle
Files in hydrat/filament-table-layout-toggle
Package filament-table-layout-toggle
Short Description Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.
License MIT
Homepage https://github.com/hydrat/filament-table-layout-toggle
Informations about the package filament-table-layout-toggle
Filament plugin adding a toggle button to tables, allowing users to switch between Grid and Table layouts.
This package brings a simple toggle button to Filament tables, allowing end users to switch between Grid and Table layouts on tables. This approach allows mobile users to benefit from the Grid layout, while desktop users can still benefit from Table layout features, such as the table headers, sorting and so on.
Big shoutout to awcodes/filament-curator, which implemented the toggle feature first on their package. This package is mainly an extraction of the feature so that it can be used in any project, and some other adding such as saving the selected layout in the cache or local storage.
Migrating from 1.x to 2.x ? : Please read the migration guide.
- Screenshots
- Installation
- Usage
- Panels
- Standalone tables
- Configuration
- Layout persister
- Per-table settings
- Using own action
- Changelog
- Migration guide
- Contributing
- Security
- Credits
- License
Screenshots
Video capture
Screen capture
installation
You can install the package via composer:
Optionally, you can publish the views using
If you are using this package outside of filament panels (standalone tables), you should publish the configuration file :
If using panels, this configuration file WILL NOT be read by the plugin, as the configuration happens on the plugin registration itself.
Usage
Please chose the appropriate section for your use case (Panels or Standalone tables).
Panels
First, register the plugin on your Filament panel :
Read more about the Layout persister and the configuration options in the Configuration section.
Please note that all those configurations are optional, and have default values, which means you can omit them if you don't need to change the default behavior.
Then, on the component containing the table (ListRecord, ManageRelatedRecords, ...), you can use the HasToggleableTable
trait :
Finally, you need to configure your table so it dynamically sets the schema based on the selected layout. This is typically done on the resource's table()
method :
Please note that you must use the Layout tools described in the filament documentation in order for your Grid layout to render correctly. You may also use the description()
method to print labels above your values.
Standalone tables
You can manage the plugin settings via the published configuration file. The options are self-documented, and should be pretty straightforward to use.
Then, on the component containing the table, you can use the HasToggleableTable
trait :
If you plan to persist the layout in the local storage, you must also change your view to include the needed assets :
Finally, you need to configure your table so it dynamically sets the schema based on the selected layout. This is typically done on the component's table()
method :
Please note that you must use the Layout tools described in the filament documentation in order for your Grid layout to render correctly. You may also use the description()
method to print labels above your values.
Configuration
Layout persister
The plugin proposes several persister classes to save the layout preference of the user :
The cache persister has several options, which you can toggle using the persistLayoutUsing
method if using the Plugin in panels, or by changing the configuration file if using standalone tables.
You can also create your own persister by implementing the the LayoutPersister
contract.
The AbstractPersister
class provides some default implementation which can be overridden if needed.
You can access the Livewire component using $this->component
.
Change settings per-table
You may need to tweak some settings for a specific table only. This can be done by overriding the default methods provided by this package in the component you are using the HasToggleableTable
trait in :
Using own action
If you rather use your own action instead of the default one, you should first disable it on the plugin registration :
Then, you can get and extend base Action
or TableAction
from the provided helper :
Changelog
Please see CHANGELOG for more information on what has changed recently.
Migration guide
Please see MIGRATION for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Thomas
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-table-layout-toggle with dependencies
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.15.0
illuminate/contracts Version ^10.0|^11.0