codewithdennis/filament-select-tree
Add a dynamic select tree field to Laravel and Filament apps. Build interactive hierarchical selection dropdowns from BelongsTo or BelongsToMany relationships, or custom queries. Customize parent and child queries, and toggle strict null-parent root nodes.
isGroupedValue() (store the parent when all children are selected) versus storing individual leaves, and enableBranchNode() (is a parent a valid selection?). Choosing wrong creates downstream problems in reporting, facet counts, and re-assignment when the hierarchy changes. This is the highest-value conversation the package forces, and it belongs to the PM, not the developer.prepend for an "Uncategorized Records" node at -1) directly supports "show me records with no category" workflows — the query needed for backfill and data-hygiene dashboards during migrations.modifyQueryUsing lets you restrict the tree per tenant or per role. The strictNullParentRootNodes() toggle is a genuine policy choice: by default, children of filtered-out parents get promoted to root nodes (to avoid empty trees) — which may surface options a user shouldn't see. Worth an explicit decision, not a default.withTrashed() lets soft-deleted categories stay visible and assignable; that's a compliance/retention stance, not a UI preference.Adopt when most of these hold:
Select in an afternoon if it disappoints.Look elsewhere — or budget for a custom field — when:
withCount() / storeResults() add work per render. Benchmark against production data first.Two dependency risks to accept knowingly: it is a single-maintainer package (plus an upstream JS library, treeselectjs) and has zero Packagist dependents — normal for a UI field in app code, but it means no downstream ecosystem is absorbing the upgrade pain with you. The release history is a mitigating signal: active patch cadence, SPA-mode fix, strict-root edge-case fix, and dependabot hygiene all suggest the maintainer responds.
For executives: This is a free, MIT-licensed UI component for our admin panel that gives users a proper drill-down selector for anything with a hierarchy — categories, departments, regions. It replaces something we would otherwise build and maintain ourselves, at an estimated one to two weeks of engineering plus permanent upkeep. Because it's a single form field, our exposure is small: if it doesn't work out, we swap it for a plain dropdown without touching the data model. The one decision we need from the business is how selections are recorded — do we assign records to a top-level category or to every sub-category? That choice affects reporting and how much work a re-categorisation becomes later, so it's worth thirty minutes of product time now.
For engineering: Filament-native field, Composer install plus filament:assets, works with BelongsTo and BelongsToMany relationships, raw queries, or a fully hand-built tree array via getTreeUsing. Covers search, branch-node selection, disabled/hidden options, soft deletes, counts, static lists, and table filters — all of which we would otherwise hand-roll. Version branches align with Filament majors, so it won't block an upgrade. Known constraints: one maintainer, an upstream JS dependency, no ecosystem dependents, and PHP-side tree construction that needs benchmarking on our largest hierarchy before we commit. Recommended posture: adopt behind a single field, verify against real data volume, and keep the option to fall back to a native Select if behaviour or maintenance disappoints.
Ask: approval to trial on one taxonomy form this sprint, with a half-hour product decision on branch-vs-leaf storage before implementation.
How can I help you explore Laravel packages today?