PHPackages                             abdelhamiderrahmouni/filament-select-tree-extended - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abdelhamiderrahmouni/filament-select-tree-extended

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abdelhamiderrahmouni/filament-select-tree-extended
==================================================

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

v0.1.1(1y ago)03MITPHPPHP ^8.1CI passing

Since Jan 31Pushed 1y agoCompare

[ Source](https://github.com/abdelhamiderrahmouni/filament-select-tree-extended)[ Packagist](https://packagist.org/packages/abdelhamiderrahmouni/filament-select-tree-extended)[ Docs](https://github.com/abdelhamiderrahmouni/filament-select-tree-extended)[ GitHub Sponsors](https://github.com/AbdelhamidErrahmouni)[ RSS](/packages/abdelhamiderrahmouni-filament-select-tree-extended/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (4)Used By (0)

Filament Select Tree
====================

[](#filament-select-tree)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9cb82c44d0eeb2f2f6251d8889a4c28ff2cc75d6d0d202f605688aae387e4c09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264656c68616d696465727261686d6f756e692f66696c616d656e742d73656c6563742d747265652d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abdelhamiderrahmouni/filament-select-tree-extended)[![Total Downloads](https://camo.githubusercontent.com/6374c17a81b0cab1409cd93a912fa1c7c6dc3b1139eb1651c59ebb726e5935e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264656c68616d696465727261686d6f756e692f66696c616d656e742d73656c6563742d747265652d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abdelhamiderrahmouni/filament-select-tree-extended)

> **Notice:** This package is for my personal use, use it at your own risk!

This package adds a dynamic select tree field to your Laravel / Filament application, allowing you to create interactive hierarchical selection dropdowns based on relationships. It's handy for building selection dropdowns with various customization options.

[![thumbnail](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/thumbnail.jpg)](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/thumbnail.jpg)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require abdelhamiderrahmouni/filament-select-tree-extended
```

```
php artisan filament:assets
```

Relationships
-------------

[](#relationships)

Use the tree for a `BelongsToMany` relationship

```
SelectTreeExtended::make('categories')
    ->relationship('categories', 'name', 'parent_id')
```

Use the tree for a `BelongsTo` relationship

```
SelectTreeExtended::make('category_id')
    ->relationship('category', 'name', 'parent_id')
```

Custom Query
------------

[](#custom-query)

Customize the parent query

```
SelectTreeExtended::make('categories')
    ->relationship(relationship: 'categories', titleAttribute: 'name', parentAttribute: 'parent_id', modifyQueryUsing: fn($query) => $query));
```

Customize the child query

```
SelectTreeExtended::make('categories')
    ->relationship(relationship: 'categories', titleAttribute: 'name', parentAttribute: 'parent_id', modifyChildQueryUsing: fn($query) => $query));
```

Methods
-------

[](#methods)

Set a custom placeholder when no items are selected

```
->placeholder(__('Please select a category'))
```

Enable the selection of groups

```
->enableBranchNode()
```

Customize the label when there are zero search results

```
->emptyLabel(__('Oops, no results have been found!'))
```

Display the count of children alongside the group's name

```
->withCount()
```

Keep the dropdown open at all times

```
->alwaysOpen()
```

Set nodes as dependent

```
->independent(false)
```

Expand the tree with selected values (only works if field is dependent)

```
->expandSelected(false)
```

Set the parent's null value to -1, allowing you to use -1 as a sentinel value (default = null)

```
->parentNullValue(-1)
```

All groups will be opened to this level

```
->defaultOpenLevel(2)
```

Specify the list's force direction. Options include: auto (default), top, and bottom.

```
->direction('top')
```

Display individual leaf nodes instead of the main group when all leaf nodes are selected

```
->grouped(false)
```

Hide the clearable icon

```
->clearable(false)
```

Activate the search functionality

```
->searchable();
```

Disable specific options in the tree

```
->disabledOptions([2, 3, 4])
```

Hide specific options in the tree

```
->hiddenOptions([2, 3, 4])
```

Allow soft deleted items to be displayed

```
->withTrashed()
```

Specify a different key for your model. For example: you have id, code and parent\_code. Your model uses id as key, but the parent-child relation is established between code and parent\_code

```
->withKey('code')
```

Store fetched models for additional functionality

```
->storeResults()
```

Now you can access the results in `disabledOptions` or `hiddenOptions`

```
->disabledOptions(function ($state, SelectTreeExtended $component) {
    $results = $component->getResults();
})
```

Filters
-------

[](#filters)

Use the tree in your table filters. Here's an example to show you how.

```
use Filament\Tables\Filters\Filter;
use Illuminate\Database\Eloquent\Builder;
use AbdelhamidErrahmouni\FilamentSelectTreeExtended\SelectTreeExtended;
```

```
->filters([
    Filter::make('tree')
        ->form([
            SelectTreeExtended::make('categories')
                ->relationship('categories', 'name', 'parent_id')
                ->independent(false)
                ->enableBranchNode(),
        ])
        ->query(function (Builder $query, array $data) {
            return $query->when($data['categories'], function ($query, $categories) {
                return $query->whereHas('categories', fn($query) => $query->whereIn('id', $categories));
            });
        })
        ->indicateUsing(function (array $data): ?string {
            if (! $data['categories']) {
                return null;
            }

            return __('Categories') . ': ' . implode(', ', Category::whereIn('id', $data['categories'])->get()->pluck('name')->toArray());
        })
])
```

Screenshots
-----------

[](#screenshots)

[![example-1](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-1.jpg)](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-1.jpg)[![example-2](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-2.jpg)](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-2.jpg)[![example-3](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-3.jpg)](https://raw.githubusercontent.com/abdelhamiderrahmouni/filament-select-tree-extended/main/resources/images/example-3.jpg)

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [AbdelhamidErrahmouni](https://github.com/abdelhamiderrahmouni)
- [Dipson88](https://github.com/dipson88/treeselectjs)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance45

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Total

3

Last Release

426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/745a0575996f5a3dcb6b8e177e5f37e610d83906028a1e99aa2ec3213a281027?d=identicon)[abdelhamiderrahmouni](/maintainers/abdelhamiderrahmouni)

---

Top Contributors

[![CodeWithDennis](https://avatars.githubusercontent.com/u/23448484?v=4)](https://github.com/CodeWithDennis "CodeWithDennis (238 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (13 commits)")[![abdelhamiderrahmouni](https://avatars.githubusercontent.com/u/26693672?v=4)](https://github.com/abdelhamiderrahmouni "abdelhamiderrahmouni (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![buzkall](https://avatars.githubusercontent.com/u/5702?v=4)](https://github.com/buzkall "buzkall (10 commits)")[![saade](https://avatars.githubusercontent.com/u/14329460?v=4)](https://github.com/saade "saade (9 commits)")[![markvaneijk](https://avatars.githubusercontent.com/u/1925388?v=4)](https://github.com/markvaneijk "markvaneijk (5 commits)")[![iotron](https://avatars.githubusercontent.com/u/50877415?v=4)](https://github.com/iotron "iotron (5 commits)")[![sebgm](https://avatars.githubusercontent.com/u/49754138?v=4)](https://github.com/sebgm "sebgm (4 commits)")[![gpibarra](https://avatars.githubusercontent.com/u/21188012?v=4)](https://github.com/gpibarra "gpibarra (4 commits)")[![ariaieboy](https://avatars.githubusercontent.com/u/15873972?v=4)](https://github.com/ariaieboy "ariaieboy (3 commits)")[![A909M](https://avatars.githubusercontent.com/u/119125167?v=4)](https://github.com/A909M "A909M (3 commits)")[![mohamedsabil83](https://avatars.githubusercontent.com/u/10126040?v=4)](https://github.com/mohamedsabil83 "mohamedsabil83 (2 commits)")[![illlust](https://avatars.githubusercontent.com/u/475315?v=4)](https://github.com/illlust "illlust (1 commits)")[![omarabdelazizgamal](https://avatars.githubusercontent.com/u/212944408?v=4)](https://github.com/omarabdelazizgamal "omarabdelazizgamal (1 commits)")[![OccTherapist](https://avatars.githubusercontent.com/u/28587659?v=4)](https://github.com/OccTherapist "OccTherapist (1 commits)")[![awcodes](https://avatars.githubusercontent.com/u/3596800?v=4)](https://github.com/awcodes "awcodes (1 commits)")[![atmonshi](https://avatars.githubusercontent.com/u/1952412?v=4)](https://github.com/atmonshi "atmonshi (1 commits)")

---

Tags

laraveltreeselectfilamentfilament-select-treetreeselectfilament-select-tree-extendedadvanced select

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/abdelhamiderrahmouni-filament-select-tree-extended/health.svg)

```
[![Health](https://phpackages.com/badges/abdelhamiderrahmouni-filament-select-tree-extended/health.svg)](https://phpackages.com/packages/abdelhamiderrahmouni-filament-select-tree-extended)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

320392.1k17](/packages/codewithdennis-filament-select-tree)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[ralphjsmit/laravel-filament-components

A collection of reusable components for Filament.

10972.2k2](/packages/ralphjsmit-laravel-filament-components)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
