Search by

alfasix / alfakit-tree

faizanakbar10

Drag-and-drop, keyboard-accessible tree pages and widgets for hierarchical Eloquent models in AlfaKit panels.

Package info

github.com/alfasixbh/alfakit-tree

Homepage

Issues

pkg:composer/alfasix/alfakit-tree

Statistics

Installs: 41

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.5 2026-10-27 09:31 UTC

This package is auto-updated.

Last update: 2026-10-29 13:41:54 UTC


README

by Alfa Six

This is a read-only split of the AlfaKit monorepo. Please open issues and pull requests there.

Hierarchical records as a drag-and-drop, keyboard-accessible tree in AlfaKit panels: a resource page, a dashboard widget and a model trait. The API follows solution-forest/filament-tree.

Installation

composer require alfasix/alfakit-tree

The tree component is built into @alfakit/react, @alfakit/vue and @alfakit/svelte.

Register

use AlfaSix\AlfakitTree\TreePlugin;

$panel->plugin(TreePlugin::make());

Usage

The model needs a nullable parent_id and an integer order column:

use AlfaSix\AlfakitTree\Concerns\HasTreeStructure;

class Category extends Model
{
    use HasTreeStructure;
}

A tree page for a resource:

use AlfaSix\AlfakitTree\Pages\TreePage;

class CategoryTree extends TreePage
{
    protected static string $resource = CategoryResource::class;

    protected static ?int $maxDepth = 3;
}

// CategoryResource::getPages()
'index' => CategoryTree::route('/'),

Or a widget:

use AlfaSix\AlfakitTree\Widgets\TreeWidget;

class MenuTree extends TreeWidget
{
    protected static ?string $model = MenuItem::class;

    protected ?string $heading = 'Menu';
}

Users drag nodes, use the move buttons or Alt + arrow keys, then save the new structure in one request; the server checks the reorder ability, the tenant and the structure (no cycles, no duplicates, at most maxDepth levels).

See the documentation for every option.

License

MIT. See LICENSE.md.