The Collapse decorator allows you to collapse the block contents while maintaining the state.
    make(Closure|string|array $labelOrFields = '', array $fields = [])
    
    make(Closure|string|array $labelOrFields = '', array $fields = [])
make(Closure|string|array $labelOrFields = '', array $fields = [])
make(Closure|string|array $labelOrFields = '', array $fields = [])
make(Closure|string|array $labelOrFields = '', array $fields = [])
 
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
    ];
}
    
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
    ];
}
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
    ];
}
//...
 

The icon() method allows you to add an icon.
    use MoonShine\Decorations\Collapse;
public function components(): array
{
    return [
        Collapse::make('Collapse')
            ->icon('heroicons.outline.users')
    ];
}
    
    use MoonShine\Decorations\Collapse;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Collapse')
            ->icon('heroicons.outline.users')
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
//...
public function components(): array
{
    return [
        Collapse::make('Collapse')
            ->icon('heroicons.outline.users')
    ];
}
//...
use MoonShine\Decorations\Collapse;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Collapse')
            ->icon('heroicons.outline.users')
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
//...
public function components(): array
{
    return [
        Collapse::make('Collapse')
            ->icon('heroicons.outline.users')
    ];
}
//...
 
    
    
        
For more detailed information, please refer to the section Icons .
     
 

By default, the Collapse decorator is displayed as collapsed.The show() method allows you to override this behavior.
    show(bool $show = true)
    
    show(bool $show = true)
show(bool $show = true)
show(bool $show = true)
show(bool $show = true)
 
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
            ->show()
    ];
}
    
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
            ->show()
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
            ->show()
    ];
}
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
            ->show()
    ];
}
 
//...
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
    return [
        Collapse::make('Title/Slug', [
            Text::make('Title'),
            Text::make('Slug')
        ])
            ->show()
    ];
}
//...
 
By default, the Collapse remembers the state, but there are times when it is not worth doing this.The persist() method allows you to override this behavior.
    persist(Closure|bool|null $condition = null)
    
    persist(Closure|bool|null $condition = null)
persist(Closure|bool|null $condition = null)
persist(Closure|bool|null $condition = null)
persist(Closure|bool|null $condition = null)
 
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
public function components(): array
{
return [
    Collapse::make('Title/Slug', [
        Text::make('Title'),
        Text::make('Slug')
    ])
        ->persist(fn () => false)
    ];
}
    
    use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
return [
    Collapse::make('Title/Slug', [
        Text::make('Title'),
        Text::make('Slug')
    ])
        ->persist(fn () => false)
    ];
}
 
//…
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
return [
    Collapse::make('Title/Slug', [
        Text::make('Title'),
        Text::make('Slug')
    ])
        ->persist(fn () => false)
    ];
}
//…
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
return [
    Collapse::make('Title/Slug', [
        Text::make('Title'),
        Text::make('Slug')
    ])
        ->persist(fn () => false)
    ];
}
 
//…
use MoonShine\Decorations\Collapse;
use MoonShine\Fields\Text;
//...
public function components(): array
{
return [
    Collapse::make('Title/Slug', [
        Text::make('Title'),
        Text::make('Slug')
    ])
        ->persist(fn () => false)
    ];
}
//…