F
Filamentβ€’3mo ago
Keika

Trick to have element be alone in a 2 column row?

Hi, I have a 2 columns setup in a Form. I want 1 element to take 1 column, then nothing next to it, then on the following row, the remaining elements. How do I get my first row setup properly? There has to be a trick to it, cant figure it out
Solution:
better example ```php ->schema([ Group::make() ->columns()...
Jump to solution
7 Replies
toeknee
toekneeβ€’3mo ago
Simple; First element: ->columnSpanFull() Next Elements: ->columnSpan(1) or wrap two elements in a 'Grid' element too with a columnSpanFull.
Keika
KeikaOPβ€’3mo ago
but I don't want the first element to take the full row. Out of the 2 columns, I want the first element to take 1 column, then an empty space, then next row, with two elements (each 1 column) | Element 1 | Nothing | | Element 2 | Element 3 | basically I want the first element (Name) to be the first, and only element on the first row
ChesterS
ChesterSβ€’3mo ago
Wrap it in a Group or something? eg
Group::make([Element ])->columns()->columnSpanFull(),
Element2, Element3
Group::make([Element ])->columns()->columnSpanFull(),
Element2, Element3
Solution
ChesterS
ChesterSβ€’3mo ago
better example
->schema([
Group::make()
->columns()
->columnSpanFull()
->schema([
TextInput::make('foo')
]),
TextInput::make('bar'),
TextInput::make('baz'),
])
->columns()
->schema([
Group::make()
->columns()
->columnSpanFull()
->schema([
TextInput::make('foo')
]),
TextInput::make('bar'),
TextInput::make('baz'),
])
->columns()
Keika
KeikaOPβ€’3mo ago
ok yes, that worked thanks! No docs for Group?
ChesterS
ChesterSβ€’3mo ago
Hmm apparently not πŸ€” You can have a look at Grid/Split, might be better to use one of those? https://filamentphp.com/docs/3.x/forms/layout/split https://filamentphp.com/docs/3.x/forms/layout/grid
toeknee
toekneeβ€’3mo ago
No but grid works as previously recommended πŸ™‚

Did you find this page helpful?