FilamentF
Filament3y ago
Emaz

Layout question - Grids and Columns on a Form

Hi folks! Glad to see this isn't a ghost town due to Laracon! lol

Layout Question - I have a fieldset that's 5 columns wide. Based on previous selections, those 5-columns will show anywhere between 1 and 5 drop downs. That's working. The use case is that on a Form the user selects a 1-5 bedroom count. Based on that, the bed types fieldset shows a drop down for each bedroom where bed type is selected (King, queen etc). But each bedroom can have two beds, bedA and BedB. If the user has selected 2 bedrooms, my code will populate 4 of the 5 columns with dropdowns so it's laid out like this:

Bed Types
Bed1a, Bed2a, Bed2a, Bed2b

But I wish I could make it a 2x2 grid within the fieldset instead, like this:

Bed Types
Bed1a Bed2a
Bed2b Bed2b

I guess I don't understand the Grid function. I'm used to setting a column count but I'm uncertain how to use Grid. Can I do this with a Grid?? Any help would be appreciated. Hope this question makes sense.
Solution
Like this
Fieldset::make('Bed Types')->schema([Grid::make(5)->schema([]), Grid::make(5)->schema([])])
Was this page helpful?