emuniq/filament-collapsible-subnav 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

emuniq/filament-collapsible-subnav

Composer 安装命令:

composer require emuniq/filament-collapsible-subnav

包简介

A Filament v3, v4 & v5 plugin for collapsible sub-navigation sidebar.

README 文档

README

Latest Version on Packagist Total Downloads Monthly Downloads License PHP Version

A Filament v3, v4 & v5 plugin that adds a collapsible toggle to sub-navigation sidebars only. Perfect for resource pages with multiple tabs or sections using ->subNavigationPosition(SubNavigationPosition::Start).

Works with both top navigation and sidebar navigation layouts — the plugin specifically targets the sub-navigation sidebar that appears on individual resource pages, not the main panel navigation.

Without Top Navigation (Sidebar Layout): Expanded Sidebar

With Top Navigation: Collapsed Sidebar

Compatibility

Plugin version Filament PHP Laravel
^1.0 v3, v4, v5 8.1+ 10 / 11 / 12 / 13

Note: This plugin only affects sub-navigation sidebars (the secondary navigation within resource pages), not the main panel sidebar. It works regardless of whether you use top navigation or sidebar navigation for your main panel layout.

Installation

Install the package via composer:

composer require emuniq/filament-collapsible-subnav

That's it! The plugin auto-registers to all panels and works immediately with zero flash.

Optional: Theme Integration

For a slight performance boost, you can integrate the CSS into your Filament theme:

php artisan collapsible-subnav:install
npm run build

This bundles the plugin CSS with your theme, reducing HTTP requests. Not required — the plugin works perfectly without this step.

Features

  • Zero configuration — Auto-registers to all panels
  • ✅ Collapsible sub-navigation sidebar toggle
  • ✅ Persistent state using cookies (server-side rendered to avoid FOUC)
  • ✅ Works with SPA mode (livewire:navigated re-sync)
  • ✅ Tooltips for collapsed items (native fallback for v4, Tippy for v3)
  • ✅ Responsive — hidden on mobile (<768px)
  • ✅ Smooth transitions
  • ✅ No theme, npm, or build step required

How It Works

The plugin automatically:

  1. Registers itself to all Filament panels on installation
  2. Injects critical CSS in the <head> to prevent flashes on reload
  3. Adds a toggle button to sub-navigation sidebars only (not main panel navigation)
  4. Persists the collapsed/expanded state via the subnav_collapsed cookie
  5. Re-syncs after each Livewire SPA navigation

The plugin detects pages with sub-navigation and only applies to those specific sidebars, leaving your main panel navigation (top or sidebar) untouched.

Manual Registration (Optional)

If you prefer manual control, you can register the plugin explicitly on individual panels:

use Emuniq\FilamentCollapsibleSubnav\CollapsibleSubnavPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(CollapsibleSubnavPlugin::make());
}

Troubleshooting

Cloudflare Rocket Loader strips the early script. The plugin marks its critical inline script with data-cfasync="false" so Rocket Loader skips it. If you still see a flash on reload, check that your CDN or HTML minifier preserves the attribute.

SPA mode (->spa()) leaves the toggle out of sync. Fixed since the SPA re-sync patch — the plugin now listens to livewire:navigated and re-applies state on every navigation.

Tooltips don't appear in Filament v4. Filament v4 doesn't expose Tippy globally; the plugin falls back to the native HTML title attribute so a tooltip always shows on hover.

Contributing

Issues and pull requests are welcome on GitHub. For bugs, please include your Filament version, PHP version, and a minimal reproduction.

Maintained by Emuniq

This plugin is built and maintained by Emuniq — a Laravel & Filament consultancy based in Mexico. We help teams ship admin panels, custom Filament resources, and SaaS backoffices.

  • 🌐 Website: emuniq.com
  • 💼 Need a hand with your Filament project? Get in touch.
  • ⭐ If this plugin saves you time, a GitHub star helps others find it.

License

The MIT License (MIT). Please see LICENSE.md for more information.

emuniq/filament-collapsible-subnav 适用场景与选型建议

emuniq/filament-collapsible-subnav 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 8.59k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2025 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「sidebar」 「subnavigation」 「collapsible」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 emuniq/filament-collapsible-subnav 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 emuniq/filament-collapsible-subnav 我们能提供哪些服务?
定制开发 / 二次开发

基于 emuniq/filament-collapsible-subnav 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 0
  • Forks: 4
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-11