Skip to content

ViewModel

ViewModel = object

Defined in: packages/schema/src/model.ts:1755

How the admin shows a resource: its names, list, filters, record page and actions, built by view(...) and sent to each user in /meta without what they cannot see. See Views.

actions: ActionModel[]

Defined in: packages/schema/src/model.ts:1800

The named actions of its records.


optional chart?: ChartModel

Defined in: packages/schema/src/model.ts:1788

A chart of records over time above the list.


optional create?: CreateModel

Defined in: packages/schema/src/model.ts:1817

The page that creates the resource’s records, in place of the create form.


optional createOpens?: AppAddress

Defined in: packages/schema/src/model.ts:1823

Its create address opens this in place of the form (.createOpens(...)).


optional export?: false | ExportModel

Defined in: packages/schema/src/model.ts:1815

Whether the list page offers Export, and the most rows a file holds; offered without a limit when omitted.


fields: Record<string, FieldViewModel>

Defined in: packages/schema/src/model.ts:1780

Hints per field, by field name.


filters: FilterWidgetModel[]

Defined in: packages/schema/src/model.ts:1784

The filter widgets above the list, in order.


optional forms?: FormModel[]

Defined in: packages/schema/src/model.ts:1825

Public forms that create its records for people without an account, each at /-/forms/<name>.


optional help?: string

Defined in: packages/schema/src/model.ts:1778

A line under the list’s title.


optional helpWhen?: HelpWhen

Defined in: packages/schema/src/model.ts:1792

When the help lines of its fields and sections show, unless their own helpWhen says; always when omitted.


optional icon?: string

Defined in: packages/schema/src/model.ts:1776

The resource’s icon in the admin’s sidebar, bottom bar and user menu, a table when it names none or one the admin does not know.


optional import?: boolean | "table"

Defined in: packages/schema/src/model.ts:1811

Whether the list page offers Import, which creates or updates records from an .xlsx, CSV or JSON file; it does when omitted. table makes it a new table users add from the file, with its fields and records.


layout: LayoutItemModel[]

Defined in: packages/schema/src/model.ts:1786

The record page’s items, in order; one section of every field when empty.


optional list?: ListModel

Defined in: packages/schema/src/model.ts:1782

The list page; the resource’s first six fields as columns when omitted.


optional listOf?: string

Defined in: packages/schema/src/model.ts:1802

The relation field whose records the list page shows instead of this resource’s rows, in their own view’s list.


optional lists?: NamedListModel[]

Defined in: packages/schema/src/model.ts:1827

Other lists of the resource, each with its own sidebar entry and address.


optional names?: object

Defined in: packages/schema/src/model.ts:1769

What one record and several are called, such as “Repair” and “Repairs”; the resource’s name in words when omitted.

plural: string

The records’ name, as in the sidebar.

singular: string

One record’s name, as in “New repair”.


optional nav?: NavModel

Defined in: packages/schema/src/model.ts:1767

Where the resource sits in the sidebar.


optional record?: RecordPageModel

Defined in: packages/schema/src/model.ts:1819

The component of the app’s own that is the whole record page, in place of the standard one.


optional recordMode?: RecordMode

Defined in: packages/schema/src/model.ts:1790

How the record page opens: as its form, a read view or a locked form; as its form when omitted.


optional recordOpens?: AppAddress[]

Defined in: packages/schema/src/model.ts:1821

The addresses a record’s page may open in its place, in order: the first whose {{field}}s all have a value in the record, filled with them.


optional recordWidth?: PageWidth

Defined in: packages/schema/src/model.ts:1796

How wide the standard record page is; a centred column when omitted.


resource: string

Defined in: packages/schema/src/model.ts:1757

The resource it shows.


optional roles?: string[]

Defined in: packages/schema/src/model.ts:1759

Shown only to users with one of these roles; a view without roles is the default.


optional saveFeedback?: SaveFeedback

Defined in: packages/schema/src/model.ts:1794

How the record page shows that a save went through.


optional saveSearch?: SaveSearchModel

Defined in: packages/schema/src/model.ts:1806

The list page’s button that saves its filter as a search of the user’s own.


optional searchesOf?: SearchesOfModel

Defined in: packages/schema/src/model.ts:1813

The list page shows the user’s saved searches of another resource, each with what it finds, instead of rows.


optional searchResult?: SearchResultModel

Defined in: packages/schema/src/model.ts:1765

A record in the global search: a title of one or more fields joined by spaces, over a subtitle field by default.


optional signIn?: SignInPromptModel

Defined in: packages/schema/src/model.ts:1804

What a visitor who is not signed in is told in place of the list, and by a favorite or “Save search” button that saves here.


optional title?: string

Defined in: packages/schema/src/model.ts:1761

Field used as the record’s display title in breadcrumbs, relation links and search results.


optional titleBadge?: string

Defined in: packages/schema/src/model.ts:1798

The field shown as a badge beside the record page’s title; an enum status field when omitted.


optional titleFrom?: TitleFromModel

Defined in: packages/schema/src/model.ts:1763

A title the browser derives per reader in place of title, by a rule of the project’s UI (see TitleFromModel).