PHPackages                             lee-to/moonshine-tree-resource - 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. lee-to/moonshine-tree-resource

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

lee-to/moonshine-tree-resource
==============================

Tree resource for moonshine

4.0.0(7mo ago)1620.4k↑21.8%4[2 issues](https://github.com/lee-to/moonshine-tree-resource/issues)MITCSSPHP ^8.2

Since May 17Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/lee-to/moonshine-tree-resource)[ Packagist](https://packagist.org/packages/lee-to/moonshine-tree-resource)[ Docs](https://moonshine-laravel.com)[ RSS](/packages/lee-to-moonshine-tree-resource/feed)WikiDiscussions 4.x Synced 2d ago

READMEChangelog (10)DependenciesVersions (19)Used By (0)

MoonShine Sortable Tree Resource
--------------------------------

[](#moonshine-sortable-tree-resource)

A modern, responsive tree component for MoonShine with drag &amp; drop sorting, compact mode, and customizable content display.

[![](https://github.com/lee-to/moonshine-tree-resource/raw/2.x/art/screenshot.png)](https://moonshine-laravel.com)

Features
--------

[](#features)

- 🚀 **Drag &amp; Drop Sorting** - Sort and reorder items with ease
- 📱 **Mobile First Design** - Responsive and touch-friendly
- 🎯 **Compact Mode** - Dense layout for data-heavy interfaces
- 🎨 **Customizable Content** - Flexible title, badge, and description
- 🌓 **Dark Mode Support** - Integrates seamlessly with MoonShine themes
- ⚡ **Optimized Performance** - Lightweight CSS with MoonShine tokens

### Requirements

[](#requirements)

- MoonShine v4.0+

Compatibility
-------------

[](#compatibility)

MoonShineTreeResource2.0+1.0+3.0+2.0+4.0+3.0+### Installation

[](#installation)

```
composer require lee-to/moonshine-tree-resource
```

```
php artisan vendor:publish --tag=moonshine-tree-assets
```

Quick Start
-----------

[](#quick-start)

Extend the TreeResource class instead of the base ModelResource

```
use Leeto\MoonShineTree\Resources\TreeResource;

class CategoryResource extends TreeResource
{
    // Required properties
    protected string $column = 'title';

    protected string $sortColumn = 'sorting';

    // ...

    // Required methods
    public function treeKey(): ?string
    {
        return 'parent_id'; // Foreign key for parent-child relationship
    }

    public function sortKey(): string
    {
        return 'sorting'; // Column for sorting
    }
}
```

And add a component to `IndexPage`

```
use Leeto\MoonShineTree\View\Components\TreeComponent;

protected function mainLayer(): array
    {
        return [
            ...$this->getPageButtons(), // $this->getButtons() in 4.0+
            TreeComponent::make($this->getResource()),
        ];
    }
```

Or override list component

```
use Leeto\MoonShineTree\View\Components\TreeComponent;

public function modifyListComponent(ComponentContract $component): ComponentContract
{
    return TreeComponent::make($this->getResource());
}
```

Update on changes (4.0+)
------------------------

[](#update-on-changes-40)

```
public function getListComponentName(): string
{
    return 'tree-component';
}

public function getListEventType(): JsEvent
{
    return JsEvent::FRAGMENT_UPDATED;
}

protected function mainLayer(): array
{
    return [
        ...$this->getButtons(),
        Fragment::make([
            TreeComponent::make($this->getResource()),
        ])->name('tree-component'),
    ];
}
```

Custom Content Display
----------------------

[](#custom-content-display)

```
public function treeItemTitle(Model $item): string
{
    return $item->{$this->getColumn()};
}

public function treeItemBadgeText(Model $item): string
{
    return $item->products_count ?? ''; // Show product count as badge
}

public function treeItemBadgeColor(Model $item): string
{
    return Color::PRIMARY; // Use Color enum for better type safety
}

public function treeItemDescription(Model $item): string
{
    return $item->short_description ?? ''; // Additional description
}
```

Configuration Options
---------------------

[](#configuration-options)

```
public function sortable(): bool
{
    return true; // Enable/disable drag & drop sorting
}

public function wrappable(): bool
{
    return true; // Enable/disable expand/collapse functionality
}

public function compactTree(): bool
{
    return false; // Enable compact mode for dense layouts
}
```

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance65

Regular maintenance activity

Popularity37

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~54 days

Recently: every ~20 days

Total

19

Last Release

165d ago

Major Versions

0.2.1 → 1.0.02023-10-29

1.2.1 → 2.0.02024-10-19

1.x-dev → 2.0.12025-05-06

2.x-dev → 3.0.02025-11-01

3.x-dev → 4.0.02025-11-23

PHP version history (2 changes)0.1.0PHP ^8.0|^8.1|^8.2

3.0.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1861327?v=4)[Danil Shutsky](/maintainers/lee-to)[@lee-to](https://github.com/lee-to)

---

Top Contributors

[![lee-to](https://avatars.githubusercontent.com/u/1861327?v=4)](https://github.com/lee-to "lee-to (28 commits)")[![shevl-dev](https://avatars.githubusercontent.com/u/118539450?v=4)](https://github.com/shevl-dev "shevl-dev (12 commits)")

---

Tags

resourcemoonshine

### Embed Badge

![Health badge](/badges/lee-to-moonshine-tree-resource/health.svg)

```
[![Health](https://phpackages.com/badges/lee-to-moonshine-tree-resource/health.svg)](https://phpackages.com/packages/lee-to-moonshine-tree-resource)
```

###  Alternatives

[kigkonsult/icalcreator

iCalcreator is the PHP implementation of rfc2445/rfc5545 and rfc updates, management of calendar information

2482.8M19](/packages/kigkonsult-icalcreator)[jasonlewis/resource-watcher

Simple PHP resource watcher library.

226146.4k14](/packages/jasonlewis-resource-watcher)[cloudstudio/resource-generator

Resource Generator for Laravel Nova

107139.7k1](/packages/cloudstudio-resource-generator)[dev-lnk/moonshine-builder

Project builder for MoonShine

255.7k](/packages/dev-lnk-moonshine-builder)[warete/moonshine-upgrade

Package for upgrade MoonShine

121.9k](/packages/warete-moonshine-upgrade)

PHPackages © 2026

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