Skip to content

ViewModel

ViewModel = object

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

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:1176

The named actions of its records.


optional chart?: ChartModel

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

A chart of records over time above the list.


optional create?: CreateModel

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

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


optional export?: false | ExportModel

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

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:1160

Hints per field, by field name.


filters: FilterWidgetModel[]

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

The filter widgets above the list, in order.


optional forms?: FormModel[]

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

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:1158

A line under the list’s title.


optional helpWhen?: HelpWhen

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

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:1156

An icon name, carried in /meta for apps that render their own shell.


optional import?: boolean

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

Whether the list page offers Import, which creates or updates records from an .xlsx or CSV file; it does when omitted.


layout: LayoutItemModel[]

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

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


optional list?: ListModel

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

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


optional listOf?: string

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

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:1194

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


optional names?: object

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

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:1147

Where the resource sits in the sidebar.


optional recordMode?: RecordMode

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

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


resource: string

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

The resource it shows.


optional roles?: string[]

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

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:1174

How the record page shows that a save went through.


optional saveSearch?: SaveSearchModel

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

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:1186

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:1145

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:1180

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:1143

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