F
Filamentβ€’17mo ago
benshawuk

ColumnSpan/grid issue with form groups

How do I make my first group span 2/3 of the page space, and the second one 1/3? I've tried various combinations of columns and columnSpan but both always seem to take 1/2 the page each..
return $form
->schema([

Forms\Components\Group::make()
->schema([
Forms\Components\Section::make('Upload File')
->schema([
Forms\Components\FileUpload::make('attachments')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'image/jpeg', 'image/png', 'text/plain'])
->maxSize(1024)
->enableDownload()
->imagePreviewHeight('250')
->loadingIndicatorPosition('left')
->panelAspectRatio('7:1')
])
]),

Forms\Components\Group::make()
->schema([
Forms\Components\Section::make('Visibility')
->schema([
Forms\Components\Toggle::make('is_private')
->label('πŸ”’ Private')
->helperText('If enabled, this file will only be accessible by you.')
->default(false),
])
]),
return $form
->schema([

Forms\Components\Group::make()
->schema([
Forms\Components\Section::make('Upload File')
->schema([
Forms\Components\FileUpload::make('attachments')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'image/jpeg', 'image/png', 'text/plain'])
->maxSize(1024)
->enableDownload()
->imagePreviewHeight('250')
->loadingIndicatorPosition('left')
->panelAspectRatio('7:1')
])
]),

Forms\Components\Group::make()
->schema([
Forms\Components\Section::make('Visibility')
->schema([
Forms\Components\Toggle::make('is_private')
->label('πŸ”’ Private')
->helperText('If enabled, this file will only be accessible by you.')
->default(false),
])
]),
2 Replies
Patrick Boivin
Patrick Boivinβ€’17mo ago
I think the form has 2 columns by default, try this:
return $form
->columns(3)
->schema([
Forms\Components\Group::make()
// ...
->columnSpan(2),
Forms\Components\Group::make()
// ...
->columnSpan(1),

// ...
return $form
->columns(3)
->schema([
Forms\Components\Group::make()
// ...
->columnSpan(2),
Forms\Components\Group::make()
// ...
->columnSpan(1),

// ...
benshawuk
benshawukOPβ€’17mo ago
Thank you, @pboivin ! That worked! πŸ™‚
Want results from more Discord servers?
Add your server