Skip to content

l

const l: object

Defined in: packages/schema/src/layout.ts:23

The items of a record page, for a view’s .layout((r) => [...]), exported as l. See The record page.

comments: (title, o) => LayoutItemModel

The record’s comments, oldest first, with who wrote each and when, and a box to write one; @ mentions someone who may read the record. Needs .comments() on the resource; a view without a layout shows it last by itself. See Record comments.

string = 'Comments'

ShowWhen

LayoutItemModel

custom: <P>(component, o) => LayoutItemModel

A component of the project, registered in protobase.ui.tsx under its name, drawn where it is listed: in the main column, or in the sidebar with sidebar: true. The record page stays around it, with its title, breadcrumbs, actions and save; the component reads the record with useLayoutRecord().

P extends object

ComponentRef<P>

ViewProps<P>

boolean

string

ShowWhen

LayoutItemModel

gallery: (title, o) => LayoutItemModel

The record’s photos as tiles in the main column, one large and the next four smaller, the last saying how many more there are, each opening a lightbox that steps through them all: first image, a file field of the record, then the image of the records of photos.resource whose relation photos.field points at the record, in photos.sort order, as a cards display’s photos names them. In the lightbox, a user who may read a photo’s record opens its details. Throws without image or photos. See Galleries.

string

Ref

CardPhotosModel

ShowWhen

LayoutItemModel

group: (title, items, o) => LayoutItemModel

A heading over sections and related tables in the main column; collapsed: true keeps it closed until the person opens it, or a link to the record does (the address names the open groups by title). Throws on any other item. See Groups.

string

LayoutItemModel[]

boolean

RecordWhen

LayoutItemModel

history: (title, o) => LayoutItemModel

The record’s changes, newest first: who made each, when, and the fields before and after, only those the user may read. limit changes show before Show more (default 10). Needs .history() on the resource; a view without a layout shows it last by itself. See Record history.

string = 'History'

number

ShowWhen

LayoutItemModel

map: (title, o) => LayoutItemModel

A map with a marker at the record’s position, read from two fields in decimal degrees (WGS84), at zoom (default 15): in the main column, or in the sidebar with sidebar: true. The app draws it with the map style of the server’s maps option or PROTOBASE_MAP_STYLE_URL, and leaves it out without one, or for a record without a position.

string

Ref

Ref

boolean

ShowWhen

number

LayoutItemModel

related: (title, o) => LayoutItemModel

A table of the records of another resource that point at this one, directly or through a join table.

string

Omit<RelatedModel, "kind" | "title">

LayoutItemModel

section: (title, fields, o) => LayoutItemModel

A titled group of fields in the main column, editable where the user may write; help is a line under the title, shown only while the record is edited with helpWhen: 'editing' (the view’s .helpWhen(...) when omitted). presentation: 'facts' shows the read view’s fields as a row of key facts, as a listing on a real estate site does: each value under its field’s .icon(...), or under its label without one, leaving out the empty ones. See Key facts.

string

Ref[]

string

HelpWhen

"facts"

RecordWhen

LayoutItemModel

sidebar: (fields, o) => LayoutItemModel

A read-only summary card of fields beside the main column.

Ref[]

RecordWhen

LayoutItemModel

view<typeof repairs>('repairs').layout((r) => [
l.section('Repair', [r.bike, r.problem, r.status]),
l.sidebar([r.booked_on, r.estimate]),
l.related('Parts used', { resource: 'repair_parts', field: 'repair_id' }),
])

Every item shows on both the form and the read view unless its when says editing (the form and the create form) or reading (the read view and the locked form). See Form and read view.