layout

I use a standard layout consisting of a content section and a sidebar, where the sidebar is divided into two grid columns and the left side is reserved for any necessary content for the resource. I want to make this repeatable and something I can use, perhaps like a pre-built function or a component, and I'm wondering how to do this in Filament. Even though I use snippets to get started, the nested hierarchy is always something I fiddle with when adding inputs to the form. Here's the code of what I use over and over again, and I would like to save myself some effort as I'm using it in almost every resource I create - is this feasible?
return $form
->schema([
Grid::make(7)
->schema([
// Primary Content Section (Content)
])
->columnSpan(5),

// Metadata Section
Section::make('Properties')
->label('Metadata')
->schema([
Grid::make(2)
->schema([
// metadata fields here
]),
])
->columnSpan(2),
]),
]);
return $form
->schema([
Grid::make(7)
->schema([
// Primary Content Section (Content)
])
->columnSpan(5),

// Metadata Section
Section::make('Properties')
->label('Metadata')
->schema([
Grid::make(2)
->schema([
// metadata fields here
]),
])
->columnSpan(2),
]),
]);
6 Replies
islandnuge
islandnugeOP4mo ago
and follows this in the form:
No description
islandnuge
islandnugeOP4mo ago
thank you @Hasan Tahseen - this is helpful
awcodes
awcodes4mo ago
GitHub
filament-extras/src/Forms/Components/FixedWidthSidebar.php at main ...
Contribute to awcodes/filament-extras development by creating an account on GitHub.
awcodes
awcodes4mo ago
Adjust accordingly.
islandnuge
islandnugeOP4mo ago
that is very cool - i'm straddling v3 and v4 projects and not sure how the new paradigm changes things and just starting to look at plugin development. Very awesome!

Did you find this page helpful?