passasooz/filament-tree-dropdown
Composer 安装命令:
composer require passasooz/filament-tree-dropdown
包简介
A generic Filament custom dropdown component for tree structures (parent-child-grandchild).
README 文档
README
A Filament component for tree-structured selection (parent → child → grandchild) with checkboxes. Supports single item selection, group selection and optional text search.
Installation
composer require passasooz/filament-tree-dropdown
Register the plugin in your Filament panel
In your PanelProvider (e.g. app/Providers/Filament/AdminPanelProvider.php), add the plugin inside the panel() method:
use Passasooz\FilamentTreeDropdown\FilamentTreeDropdownPlugin; public function panel(Panel $panel): Panel { return $panel // ... other configuration ->plugins([ FilamentTreeDropdownPlugin::make(), ]); }
Publish the view (optional)
To override the blade view in your project:
php artisan vendor:publish --tag="filament-tree-dropdown-views"
Usage
use Passasooz\FilamentTreeDropdown\Forms\Components\TreeDropdown;
Fluent builder
Use group() for group nodes and item() for leaf nodes.
Methods are chainable and nesting levels are unlimited.
TreeDropdown::make('category') ->label('Category') ->group('Animals', function ($g) { $g->group('Mammals', function ($g) { $g->item('Dog', 'dog'); $g->item('Cat', 'cat'); }); $g->group('Birds', function ($g) { $g->item('Stork', 'stork'); $g->item('Parrot', 'parrot'); }); }) ->group('Plants', function ($g) { $g->item('Rose', 'rose'); $g->item('Oak', 'oak'); }) ->searchable() // optional
Raw array
If your data is already structured (e.g. from a DB or API):
TreeDropdown::make('category') ->tree([ [ 'label' => 'Animals', 'children' => [ ['label' => 'Dog', 'value' => 'dog'], ['label' => 'Cat', 'value' => 'cat'], ], ], ]) ->searchable()
You can change the array keys if your data uses different names:
->labelKey('name') // default: 'label' ->valueKey('id') // default: 'value' ->childrenKey('items') // default: 'children'
Options
| Method | Description |
|---|---|
->searchable() |
Enables the search bar inside the dropdown |
->searchable(false) |
Disables search (default) |
->label('...') |
Field label and placeholder text |
How search works
Search filters by substring on the item label (case-insensitive).
- Query
"stork"→ shows all items whose label contains"stork" - Query
"sto"→ shows all items whose label contains"sto"(e.g. "Stork" is shown) - Parent groups are shown automatically if at least one child matches
- Groups with no matching children are hidden
Selection behaviour
- Leaf node: toggles the single value.
- Group node: selects/deselects all descendant leaf nodes.
- Checkbox is indeterminate when only some children are selected.
- Groups can be expanded/collapsed with the arrow icon (only when search is inactive).
Development / customisation
- Source files are in
src/Forms/Components/. - The view is in
resources/views/tree-dropdown.blade.php. - Publish the view with
vendor:publishto override it in your project.
passasooz/filament-tree-dropdown 适用场景与选型建议
passasooz/filament-tree-dropdown 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tree」 「form」 「component」 「laravel」 「select」 「dropdown」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 passasooz/filament-tree-dropdown 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 passasooz/filament-tree-dropdown 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 passasooz/filament-tree-dropdown 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
FSi DataSource Component
jsTree widget for yii2
Doctrine2 behavior traits - slowhop fork
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Priveate for SkeekS CMS
A Laravel Filament Forms slug field.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-10