Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MiguelStevens's avatar

Laravel Nova Resource, combine fields in layout?

I'm using Laravel and Nova, I have a Collection resource which has multiple fields, now when you define the fields for example:

Text::make('Meta 1 Label')->hideFromIndex(),
Text::make('Meta 1 Value')->hideFromIndex(),
Text::make('Meta 2 Label')->hideFromIndex(),
Text::make('Meta 2 Value')->hideFromIndex(),
Text::make('Meta 3 Label')->hideFromIndex(),
Text::make('Meta 3 Value')->hideFromIndex(),
Text::make('Meta 4 Label')->hideFromIndex(),
Text::make('Meta 4 Value')->hideFromIndex(),

Each field will take up one row, in the html.

with

Now I'm wondering if it's possible to have custom layout options (without having to make a full blown custom Tool), so that it's possible for example to group a few text fields in a div.

Pseudo Code

<div class="flex">
    Text::make('Meta 1 Label')->hideFromIndex(),
    Text::make('Meta 1 Value')->hideFromIndex(),
</div>
<div class="flex">
    Text::make('Meta 2 Label')->hideFromIndex(),
    Text::make('Meta 2 Value')->hideFromIndex(),
</div>
0 likes
5 replies
MiguelStevens's avatar

Thanks for your answer, that still however doesn't allow me to stack input fields next to each other, each Field is still a line on its own..

mattsuyolo's avatar

miguelStevens can you share your answer if you found one ?

JBF's avatar

Haven't tried it but that package has been taken over by someone else...

https://github.com/nibri10/nova-grid

I've been reading the documentation for Nova and it seems very nice and powerful but it does seem strange that there is no easy way to change the layout of the fields. If you just want to have two fields next to each other, it seems overkill to have to make a package for a custom field. If there's no extra logic and it's just a simple layout issue, there should be a simpler way IMO.

3 likes

Please or to participate in this conversation.