Skip to content

l

const l: object

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

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

blocks: (tree, o) => LayoutItemModel

A tree of layout blocks, written in JSX as a composed page’s, inside the page’s own record: @root in a path, and the record a bare name reaches last, so {{@root.id}} or {{id}} reads its key from the address and {{@root.owner_id}} a field read beside the tree’s reads, never before them. The server checks it against the resources when it starts and plans its reads as a page’s. Its root is any element but a Page; it sets no page parameters or tabs of its own. See Record pages.

BlockElementModel

ShowWhen

LayoutItemModel

chart: (title, o) => LayoutItemModel

Line graphs of numeric fields of the records of resource that point at this one through field, such as a machine’s metric samples, over their timestamp at: per minute over the last hour, per 5 minutes over the last day and per hour over the last week, the average or the maximum of each bucket, opening on range (default 1h). A bucket without a sample is a gap. Throws without a series. See Charts of related records.

string

string

string

string

RecordChartRange

string

string[]

ShowWhen

LayoutItemModel

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

composer: (o) => LayoutItemModel

A box that adds a message to the record’s conversation: each send creates a record of resource with the text in text and the record’s key in its relation field, for a user who may create them. See Conversations.

Omit<ComposerSectionModel, "kind">

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(). A client that cannot draw it, one without the component or the web when it throws, shows fallback in its place: any main-column item in the main column, conversations and other custom components included, sidebar maps and sidebar custom components in the sidebar, or [] for nothing. Throws on any other fallback item.

P extends object

ComponentRef<P>

LayoutItemModel[]

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). help is a line under the heading; count: true shows how many records its related tables hold together. Throws on any other item, and on count without a related table. See Groups.

string

LayoutItemModel[]

boolean

boolean

string

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

tab: (title, items) => LayoutItemModel

A tab of the record page holding main-column items: sections, groups, related tables, custom components, maps, charts, trends, galleries, history, comments, conversations and block trees. A view’s tabs stand together and show as one strip, the first tab open unless the address names another; items before and after them show on every tab. Throws on a sidebar item or another tab. See Tabs.

string

LayoutItemModel[]

LayoutItemModel

thread: (title, o) => LayoutItemModel

The record’s conversation: the latest messages of resource whose relation field points at the record, oldest first, each text under its sender and time, limit at first (default 50) and earlier ones on request. The text shows as markdown when the message resource’s view marks it .markdown(). With calls, the tool calls of another resource pointing at the record show between the messages in time order. Pair it with l.composer to write one. Throws on a limit that is not a positive whole number. See Conversations.

string

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

LayoutItemModel

trend: (title, o) => LayoutItemModel

Bars of how many records of resource point at this one through field, per granularity of their date or timestamp at over range, with the options of a list’s chart: such as an objective’s shipped tasks per week over 90 days. Records without an at are not counted. See Trends of related records.

string

string

string

ChartGranularity

string

ChartRange

string

ShowWhen

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.