Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Collapse Laravel Package

drafolin/filament-collapse

drafolin/filament-collapse is a Filament plugin for building collapsible form sections. Wrap fields in expandable panels to keep long forms tidy, reduce scrolling, and let users focus on the inputs that matter. Simple to install and configure in Filament resources and forms.

View on GitHub
Deep Wiki
Context7

Getting Started

Install

composer require drafolin/filament-collapse

There is no service provider config to publish in most setups — the package ships a Filament form component you reference directly from your form schema. Check composer.json of the package for the filament/filament constraint before installing (see Gotchas).

Where to look first

  1. The GitHub README (drafolin/filament-collapse) — it documents the single component class and its fluent API. With 12 stars and a single maintainer, treat the README and src/ as the canonical docs; there is no docsite, no ecosystem, no StackOverflow corpus.
  2. vendor/drafolin/filament-collapse/src/ — read the component class itself. This is a small package; the source is the fastest way to confirm the exact namespace, method names, and how state is merged.
  3. The linked analogy, Filament\Forms\Components\ToggleButtons::grouped(), in Filament's own source — the package deliberately mirrors that grouping UX, so understanding grouped() tells you what the package is trying to reproduce for arbitrary fields.

First use case The package is aimed at the "many small fields, one visual unit" problem: a country-code select plus a phone-number input, a currency selector plus an amount, or a prefix plus an identifier. Instead of rendering each field on its own row inside the form grid, you wrap them in the collapse component so they render grouped/condensed — the same feel as ToggleButtons->grouped(), but for fields that aren't toggle buttons. The quickest sanity check is a throwaway form on an existing resource: wrap two related fields, verify values still hydrate and validate correctly in create and edit.

Implementation Patterns

Grouping sibling fields in a form schema The core pattern is to use the component as a wrapper/layout element inside form(Schema $schema), passing the child fields in. Treat it like a Group or Fieldset for layout purposes — it controls presentation, not the field names or validation rules. Keep the fields' own ->required(), ->rules(), and ->reactive() declarations on the children, not on the wrapper.

use Drafolin\FilamentCollapse\...; // confirm from src/

Select::make('country_code')->options(...)->required(),
TextInput::make('phone')->tel()->required(),

placed inside the collapse component so they render as one grouped block rather than two stacked inputs.

Pairing with reactive/live forms Because the visible behavior mimics grouped(), the most valuable day-to-day use is compact conditional UI: wrap a set of fields that belong together logically (address line 1 + 2, or a metric + unit selector) and drive their visibility off a single toggle elsewhere in the form. Keep the ->live()/->reactive() on the driver field, not the collapsed wrapper, so the wrapper doesn't add unnecessary update round-trips.

Inside resources, relation managers, and settings pages The component is a schema element, so it drops into any Schema container: resource create/edit forms, RelationManager forms, and Settings page schemas alike. The pattern to standardize on is a small private method on the resource (e.g. phoneFieldGroup()) returning the pre-configured collapse block, so the same grouped layout is reused across resource forms without copy-paste drift.

Compact "segmented" UX without ToggleButtons Where you would otherwise reach for a ToggleButtons or Radio field with a small option set, the collapse grouping lets you build a custom compact control out of plain fields. Use this sparingly — you get the look of grouped() without the accessibility/keyboard semantics that the native control brings, so reserve it for genuinely low-stakes inputs.

Layout discipline in the grid Because it's a wrapper, its column span matters more than the children's. Set ->columnSpan(...) / ->columnSpanFull() on the collapse wrapper and let the children fill it, rather than fighting the parent grid from inside. Test in a two-column resource form, since that's the common realistic layout.

Gotchas and Tips

  • Version compatibility is the biggest risk. A 12-star package released 2025-01-16 has likely only been exercised against one Filament major version. Filament's form component API shifted between v3 and v4 (schema/Schema, namespace changes). Pin your filament/filament constraint and test the component against your app's version before adopting it — do not assume the README matches your install.
  • It's presentation, not schema. The component collapses visually; it does not merge state paths, validation, or dehydrated() behavior. If country_code and phone need to combine into one column, do that with a ->dehydrateStateUsing() on the field or a form mutateFormDataBeforeSave, not by hoping the wrapper does it.
  • Single-maintainer, low-activity package. With 12 stars, expect no support channel and slow fixes. Budget time to vendor a patch or copy the component into app/Filament/Components/ and own it if you depend on it in production. MIT means this is a legitimate option and often the right one for something this small.
  • Debugging render issues starts at the wrapper. If fields don't appear grouped, first confirm the component class was imported from the correct namespace and that it's a layout element (has components([...])), not a field expecting ->options(). Second, check column spans — "not grouped" is frequently just "wrapped onto two grid rows."
  • Nested state and reactive forms: when the collapsed fields react to each other, verify Livewire updates still fire. Wrappers that re-render can occasionally drop focus or reset cursor position on text inputs — test typing in a collapsed input with ->live(debounce: ...) on a sibling.
  • Extension points: since the source is small, the practical extension point is subclassing the component or copying it and customizing the Blade view (publish views if the package supports it, otherwise view() on your subclass). Don't wait on upstream for a view tweak.
  • Testing: add a feature test that loads the create form and asserts both child fields are present (assertFormFieldExists) and that validation still runs on each child — cheap insurance that a Filament upgrade didn't silently change how the wrapper mounts children.
  • When not to use it: if you only need two fields on one row, plain Grid::make(2) or a Group with columns() gets you there with zero third-party risk. Reach for this package specifically when you want the condensed grouped aesthetic that plain layout can't produce.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console