View Spec
Define table-based UI and query behavior for any model in Locospec.
A View Spec defines how data from a model should be queried, filtered, and presented—typically in a table, list, or kanban view. It’s where search, pagination, filters, and row actions come together.
If the Model is your database, the View is your UI window into it.
🧩 Basic Structure
⚙️ Required Fields
| Field | Type | Description |
|---|---|---|
name | string | Unique ID for the view (snake/kebab case) |
type | "view" | Must always be "view" |
label | string | Human-readable label |
model | string | Name of the associated model |
attributes | array | List of model attributes shown in the view |
🔎 lensSimpleFilters
Define which attributes should appear as quick filters in the UI. These are shallow filters like:
They reference attributes from the model (or related attributes via dot paths).
🧠 scopes and allowedScopes
scopesallows you to define inline filters using filter groupsallowedScopesrestricts which defined scopes can be used in this view
🪄 expand
You can declare expandable fields to show detailed info per row. This is useful when your view needs to show or filter based on fields from related models—without requiring additional queries.
This instructs Locospec to include the full related model's data in the result.
✅ selectionType & selectionKey
Define whether users can select rows and what key represents the selected item.
This enables row-level selection in UI components.
🛠️ actions
Configure row-level actions (like "Edit", "Delete", "view").
Each action supports:
key,label,iconurlwith path interpolation ({uuid})confirmation: whether to show a confirmation dialog
Nested options (dropdown-style) are also supported per action.
🔢 serialize
Show row numbers automatically with customizable options.
Or use an object for advanced config: