Skip to main content

Module layout

Module layout 

Source
Expand description

The layout of a resource’s form, as Filament’s layout components: a grid of columns, Sections that group fields under a heading, and Groups that stack sections in one column, each with a column_span.

A WordPress-like post editor puts the content in a main column two thirds wide and the publishing settings in a sidebar column one third wide, as a Filament form does with ->columns(3) and a Group of sections with ->columnSpan(2) beside one with ->columnSpan(1):

use ignite_core::{FormLayout, Group, Section};

let layout = FormLayout::new().columns(3).schema([
    Group::make([Section::make("Content").schema(["title", "slug", "body"])]).column_span(2),
    Group::make([
        Section::make("Publish").schema(["status", "published_at"]),
        Section::make("Category").schema(["category"]),
    ])
    .column_span(1),
]);
assert_eq!(layout.column_count(), Some(3));

As in Filament, columns and column_span apply from the lg breakpoint; on a smaller screen every component takes the full width, one under the other. A form without a layout (the default, FormLayout::new) renders as before: one card of fields. A field the layout does not place is shown after the others, in the first column, so a form never loses a field it saves.

Structs§

FormLayout
The layout of a resource’s create and edit forms: the grid’s columns, the components in it, and the page’s content width. See the module documentation.
Group
Sections and fields stacked one under the other in one column of the form, as Filament’s Group: a sidebar is a group of sections.
Section
Fields under a heading, shown as one card, as Filament’s Section.

Enums§

ColumnSpan
How many grid columns a component takes, as Filament’s columnSpan().
Component
One part of a form layout: a field by name, a Section or a Group.
Width
The widest the page’s content may be, as Filament’s getMaxContentWidth() and its Width enum. The panel’s default is ScreenTwoExtraLarge.