Components

Sidebar

Basics

Used to create MoonShine layouts.

The Sidebar component is designed to create a side menu.

make(iterable $components = [])
make(iterable $components = [])
  • $components - array of components.
use MoonShine\UI\Components\Layout\Menu;
use MoonShine\UI\Components\Layout\Sidebar;
 
Sidebar::make([
Menu::make(),
])
use MoonShine\UI\Components\Layout\Menu;
use MoonShine\UI\Components\Layout\Sidebar;
 
Sidebar::make([
Menu::make(),
])
<x-moonshine::layout.sidebar :collapsed="true">
<x-moonshine::layout.menu
:elements="[
['label' => 'Dashboard', 'url' => '/'],
['label' => 'Section', 'url' => '/section'],
]"
/>
</x-moonshine::layput.sidebar>
<x-moonshine::layout.sidebar :collapsed="true">
<x-moonshine::layout.menu
:elements="[
['label' => 'Dashboard', 'url' => '/'],
['label' => 'Section', 'url' => '/section'],
]"
/>
</x-moonshine::layput.sidebar>

Collapsible Option

By default, the Sidebar is always open, but using the collapsed() method, you can add the option to hide the Sidebar.

Sidebar::make([
Menu::make(),
])->collapsed()
Sidebar::make([
Menu::make(),
])->collapsed()