Skip to main content

Introduction

Filters allow users to scope table data and find specific information. They’re defined in the $table->filters() method and provide various ways to constrain your query.

Available filter types

Basic Filter

Simple checkbox or toggle filter

Select Filter

Dropdown with predefined options

Ternary Filter

Three-state filter (true/false/blank)

Query Builder

Advanced filter combinations

Basic filter

The default filter renders as a checkbox. When checked, the query() callback is applied:

Using a toggle instead

Replace the checkbox with a toggle button:

Applying by default

Enable a filter by default:

Select filter

Provide a dropdown of predefined options:

Custom attribute

By default, the filter uses its name as the column. Override with attribute():

Multi-select filters

Allow selecting multiple options:

Relationship filters

Automatically populate options from a relationship:

Searchable relationship filters

Including empty relationships

Add a “None” option for records without a relationship:

Applying select filters by default

Native select vs. custom select

Use a native HTML select for better mobile experience:

Ternary filter

Provide three states: true, false, and blank (no filter):

Simplified boolean ternary

For simple boolean columns:

Filtering soft-deleted records

Use the built-in TrashedFilter:
This provides options to show only active records, only trashed records, or all records.

Query Builder filter

Allow users to create complex filter combinations:

Available constraints

  • TextConstraint - Text fields with operators like contains, starts with, equals
  • BooleanConstraint - True/false values
  • DateConstraint - Date comparisons
  • NumberConstraint - Numeric comparisons
  • SelectConstraint - Predefined options
  • RelationshipConstraint - Related records

Custom filters

Build custom filters using any form field:

Indicators for custom filters

Show active filter indicators:

Filter layout

By default, filters appear in a dropdown. Change the layout:
Available layouts:
  • FiltersLayout::Dropdown (default)
  • FiltersLayout::AboveContent
  • FiltersLayout::AboveContentCollapsible
  • FiltersLayout::BelowContent

Live filters

By default, filter changes are deferred until clicking “Apply”. Make filters live:

Persisting filters

Save filter state in the user’s session:

Customizing the filters trigger

Add searchable columns to enable global search:
Add search inputs per column:
Disable global search but keep individual search:

Search customization

Customize the search placeholder:
Adjust search debounce:
Search only on blur:

Laravel Scout integration

Use Laravel Scout for full-text search: