l
constl: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.
Type Declaration
Section titled “Type Declaration”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”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().
Type Parameters
Section titled “Type Parameters”P extends object
Parameters
Section titled “Parameters”component
Section titled “component”ComponentRef<P>
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). Throws on any other item. See
Groups.
Parameters
Section titled “Parameters”string
collapsed?
Section titled “collapsed?”boolean
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”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.