StackFields

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

The StackFields field allows you to group fields when displayed on the index page.

The fields() method needs to pass an array of fields for grouping.

The withLabels() method can be used to display labels on the index page

use MoonShine\Fields\BelongsTo;
use MoonShine\Fields\StackFields;
use MoonShine\Fields\Text;
//...
 
public function fields(): array
{
return [
StackFields::make('Title')->fields([
Text::make('Title'),
BelongsTo::make('Author', resource: 'name'),
])
];
}
 
//...