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

ActiveLibrary

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

Tree resource for moonshine

4.0.0(5mo ago)1617.7k—7.1%4[2 issues](https://github.com/lee-to/moonshine-tree-resource/issues)MITCSSPHP ^8.2

Since May 17Pushed 3mo 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 1mo 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

50

—

FairBetter than 96% of packages

Maintenance72

Regular maintenance activity

Popularity36

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

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

118d 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

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[sylius/resource-bundle

Resource component for Sylius.

23410.2M173](/packages/sylius-resource-bundle)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[kigkonsult/icalcreator

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

2462.6M16](/packages/kigkonsult-icalcreator)[sylius/grid-bundle

Amazing grids with support of filters and custom fields integrated into Symfony.

1358.3M44](/packages/sylius-grid-bundle)[laravel-lang/common

Easily connect the necessary language packs to the application

1463.1M22](/packages/laravel-lang-common)

PHPackages © 2026

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