Group Builder Blocks and Query Builder constraints under headings

Group Builder Blocks and Query Builder constraints under headings

  • builder
  • builder blocks
  • form
  • query builder
  • table
PR #20722 by @danharrin

For long lists of Builder blocks or Query Builder filters, pass a named array and the picker shows each group under a heading.

E.g.: on a page builder field, the picker can have Content and Media sections:

Builder::make('content')
    ->blocks([
        'Content' => [
            Block::make('heading')->schema([TextInput::make('text')]),
            Block::make('paragraph')->schema([Textarea::make('text')]),
        ],
        'Media' => [
            Block::make('video')->schema([TextInput::make('url')->url()]),
        ],
    ]),

QueryBuilder::make()->constraints([...]) works the same way.

Once filters are grouped, the OR option moves into its own Logic group.

Grouping only changes the picker, so saved data and how queries run don't change.

Ungrouped items show first with no heading, and search hides groups with no matches.

Group names have to be text keys: a numeric name like '2026' turns into an integer key, and those items are treated as ungrouped.

QueryBuilder::make()
    ->constraints([
        'Content' => [
            TextConstraint::make('title'),
            TextConstraint::make('content'),
        ],
        'Publishing' => [
            DateConstraint::make('published_at'),
        ],
    ]),
All Filament Up To Date tips