l
constl: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.
Type Declaration
Section titled “Type Declaration”blocks
Section titled “blocks”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
string
string
string
range?
Section titled “range?”resource
Section titled “resource”string
series
Section titled “series”string[]
Returns
Section titled “Returns”comments
Section titled “comments”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.
Parameters
Section titled “Parameters”title?
Section titled “title?”string = 'Comments'
Returns
Section titled “Returns”composer
Section titled “composer”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.
Parameters
Section titled “Parameters”Omit<ComposerSectionModel, "kind">
Returns
Section titled “Returns”custom
Section titled “custom”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.
Type Parameters
Section titled “Type Parameters”P extends object
Parameters
Section titled “Parameters”component
Section titled “component”ComponentRef<P>
fallback?
Section titled “fallback?”props?
Section titled “props?”ViewProps<P>
sidebar?
Section titled “sidebar?”boolean
title?
Section titled “title?”string
Returns
Section titled “Returns”gallery
Section titled “gallery”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.
Parameters
Section titled “Parameters”string
image?
Section titled “image?”photos?
Section titled “photos?”Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
collapsed?
Section titled “collapsed?”boolean
count?
Section titled “count?”boolean
string
Returns
Section titled “Returns”history
Section titled “history”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.
Parameters
Section titled “Parameters”title?
Section titled “title?”string = 'History'
limit?
Section titled “limit?”number
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
latitude
Section titled “latitude”longitude
Section titled “longitude”sidebar?
Section titled “sidebar?”boolean
number
Returns
Section titled “Returns”related
Section titled “related”related: (
title,o) =>LayoutItemModel
A table of the records of another resource that point at this one, directly or through a join table.
Parameters
Section titled “Parameters”string
Omit<RelatedModel, "kind" | "title">
Returns
Section titled “Returns”section
Section titled “section”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.
Parameters
Section titled “Parameters”string
fields
Section titled “fields”Ref[]
string
helpWhen?
Section titled “helpWhen?”presentation?
Section titled “presentation?”"facts"
Returns
Section titled “Returns”sidebar
Section titled “sidebar”sidebar: (
fields,o) =>LayoutItemModel
A read-only summary card of fields beside the main column.
Parameters
Section titled “Parameters”fields
Section titled “fields”Ref[]
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”thread
Section titled “thread”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.
Parameters
Section titled “Parameters”string
Omit<ThreadSectionModel, "kind" | "title">
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
string
string
granularity
Section titled “granularity”string
resource
Section titled “resource”string
Returns
Section titled “Returns”Example
Section titled “Example”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.