Write a view
Put view files insrc/slots/<slot>/ with a .view.tsx suffix. This view supplies default UI for the panel slot:
src/slots/panel/index.view.tsx
index.view.tsx maps to /, and members/detail.view.tsx or members.detail.view.tsx maps to /members/detail. An explicit view gives useContext() its inferred type and must match that path. The build rejects mismatched view or slot declarations.
Use components and tools
Add another view for/members/detail. With Button and showToast exposed in the contract, generated imports let you use them together:
src/slots/panel/members.detail.view.tsx
Supply several instances
For atile slot declared with multiple: true, return an entry for each dashboard tile:
src/slots/tile/index.view.tsx
resolve runs on the app server. It can use the current context and registered queries to load entries. useInstance() reads the selected entry in the UI. The surrounding dashboard decides how to use position metadata.
For a repeatable page slot, use the same pattern with keys such as reports and activity, and metadata such as { label: "Reports", icon: "chart" } for sidebar links.
SDK reference
ImportdefineView from patchsmith/client. The build discovers .view.tsx files and extracts instance resolvers into the server bundle.
The resolver receives
{ context, identity, signal, queries }. It can call registered queries; actions and mutations are unavailable there.
Each entry needs a stable, non-empty key unique within its view, a metadata object, and data matching dataSchema. Use metadata for labels or placement hints and data for values the view renders:
view.useInstance() reads the selected entry, with its data type inferred from dataSchema.
Frequently asked questions
View filenames determine context paths. Instance metadata describes labels and placement; instance data supplies rendered values.Does naming a file index.view.tsx make it the default view?
Does naming a file index.view.tsx make it the default view?
Yes.
index.view.tsx produces /; members/index.view.tsx produces
/members. Explicit view values must agree with the file path. Only
.view.tsx files register views.Where do instance labels and layout rules belong?
Where do instance labels and layout rules belong?
Return labels, icons, or placement hints in
metadata. The surrounding UI
uses them to build links or arrange tiles. Put values your view needs to
render in data.