Section
A titled card that groups fields.
use Anvil\Schema\Layout\Section;
Section::make('Invoice') ->description('Basic data') ->columns(2) ->schema([...]),
Section::make('Internal')->collapsed()->schema([ Textarea::make('notes'),]),| Method | Effect | Default |
|---|---|---|
Section::make('Heading') |
heading of the card | |
description('…') |
text below the heading | none |
columns(1–4) |
columns of the inner grid | 1 |
schema([...]) |
the components | |
collapsible() |
the user can fold the section | open, not collapsible |
collapsed() |
collapsible and closed at first, e.g. for rarely used fields | |
hiddenOn(...) |
hides the section and its fields in operations | |
columnSpan(n) |
width of the section in its container | full width |
- Headings and descriptions are escaped.
- Collapsible sections are a native
<details>element and need no JavaScript; they are keyboard accessible. - Fields in a closed section are still part of the form: they are submitted and validated. An error in a closed section opens it.
- The detail page shows the section the same way, read-only.