Basics
Collapse
allows you to collapse the content of a block, which can contain various components.
When collapsed, the state of the components remains unchanged.
make(Closure|string $label = '',iterable $components = [],bool $open = false,bool $persist = true)
make(Closure|string $label = '',iterable $components = [],bool $open = false,bool $persist = true)
$label
- the title ofCollapse
,$components
- a set of components inside theCollapse
,$open
- a flag that defines whether theCollapse
is collapsed or expanded by default,$persist
- state preservation inside theCollapse
.
use MoonShine\UI\Components\Collapse;Collapse::make('Title/Slug', [Text::make('Title'),Text::make('Slug'),])
use MoonShine\UI\Components\Collapse;Collapse::make('Title/Slug', [Text::make('Title'),Text::make('Slug'),])
<x-moonshine::collapse:label="'Title/Slug'":components='$components'/>
<x-moonshine::collapse:label="'Title/Slug'":components='$components'/>
Icon
The icon()
method allows you to add an icon.
icon(string $icon,bool $custom = false,?string $path = null)
icon(string $icon,bool $custom = false,?string $path = null)
For more detailed information, refer to the icons section.
Display
By default, the Collapse
decorator is displayed in a collapsed view.
The open()
method allows you to override this behavior.
open(Closure|bool|null $condition = null)
open(Closure|bool|null $condition = null)
State Persistence
By default, Collapse
remembers its state, but there are cases where this should not happen.
The persist()
method allows you to override this behavior.
persist(Closure|bool|null $condition = null)
persist(Closure|bool|null $condition = null)