Components

Decoration Block

Make

The Block decorator allows you to create stylized blocks.

You can create a Block using the static make() method.

make(Closure|string|array $labelOrFields = '', array $fields = [])
use MoonShine\Decorations\Block;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
return [
Block::make('Block title', [
Text::make('Name', 'first_name')
])
];
}
 
//...

block block_dark

No title

If the block does not need title, then the make() method only has to pass an array.

use MoonShine\Decorations\Block;
use MoonShine\Fields\Text;
 
//...
 
public function components(): array
{
return [
Block::make([
Text::make('Name', 'first_name')
])
];
}
 
//...

block_without_title block_without_title_dark

Icon

The icon() method allows you to add an icon.

use MoonShine\Decorations\Block;
 
//...
 
public function components(): array
{
return [
Block::make('Block')
->icon('heroicons.outline.users')
];
}
 
//...

For more detailed information, please refer to the section Icons.

block_icon block_icon_dark