Fixing search and filter styling to match Filament table layouts#109
Fixing search and filter styling to match Filament table layouts#109Luckcatcher wants to merge 1 commit intorelaticle:3.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the table filters/search header toolbar markup so the search + filter trigger align/styling matches Filament table layouts (right-justified), including reordering the search before the filters trigger UI.
Changes:
- Wraps the header toolbar contents in an additional container to align with Filament’s expected DOM structure.
- Reorders the search field to render before filter dialog/trigger elements.
- Adds a placeholder element to satisfy
nth-child(2)-based header toolbar styling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div class="fi-ta-header-toolbar px-0"> | ||
| <div> | ||
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions divs here and needs an element before any other search or filter elements --}} | ||
| </div> | ||
| <div class="items-center gap-x-4"> |
There was a problem hiding this comment.
The new toolbar markup drops the flex items-center gap-x-4 mb-4 utility classes that previously ensured horizontal alignment and spacing between the toolbar and the table content. If fi-ta-header-toolbar isn’t guaranteed (by Filament CSS) to provide these styles, the search/filters UI may stack vertically and/or sit flush against the content. Consider restoring equivalent flex + gap + bottom spacing either on fi-ta-header-toolbar or on the inner container (and ensure the container that holds the search/dropdown is display: flex).
| <div class="fi-ta-header-toolbar px-0"> | |
| <div> | |
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions divs here and needs an element before any other search or filter elements --}} | |
| </div> | |
| <div class="items-center gap-x-4"> | |
| <div class="fi-ta-header-toolbar mb-4 px-0"> | |
| <div> | |
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions divs here and needs an element before any other search or filter elements --}} | |
| </div> | |
| <div class="flex items-center gap-x-4"> |
| > | ||
| <div class="fi-ta-header-toolbar px-0"> | ||
| <div> | ||
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions divs here and needs an element before any other search or filter elements --}} |
There was a problem hiding this comment.
This comment has a small grammar issue: “assumes an actions divs here” should be “assumes an actions div here” (or “assumes an actions div is here”).
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions divs here and needs an element before any other search or filter elements --}} | |
| {{-- fi-ta-header-toolbar has an nth-child(2) styling that assumes an actions div is here and needs an element before any other search or filter elements --}} |
Fixes filter styling in v3 to match Filament tables, justified to the right.
The diff shows a lot of changes which are just the result of adding a wrapper div in $hasHeaderToolbar. The only real changes are this wrapper div, moving "fi-ta-header-toolbar px-0" classes into the wrapper div, and moving the search to be before the filter. It also needs a dummy div, explained in the code.
Tested with all FiltersLayout types.
Before:

After:
