Decoration Collapse

# Make

The Collapse decorator allows you to collapse the block contents while maintaining the state.

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')
])
];
}
 
//...

# Show

By default, the Collapse decorator is displayed as collapsed. The show() method allows you to override this behavior.

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()
];
}
 
//...