UI Extensions
Add HotCRM views, pages, dashboards, and actions.
UI Extensions
HotCRM UI metadata lives under the owning package's own directories — src/*/views/, src/*/pages/, src/*/dashboards/, src/*/reports/ and src/*/actions/, where * is one of the four packages (sales, service, revenue, marketing). An item lives with the object it is authored against.
Add an action
// src/sales/actions/opportunity.actions.ts
import type { Action } from '@objectstack/spec/ui';
export const MarkOpportunityReviewedAction: Action = {
name: 'mark_opportunity_reviewed',
label: 'Mark Reviewed',
objectName: 'crm_opportunity',
icon: 'check-circle',
type: 'modal',
target: 'mark_opportunity_reviewed',
locations: ['record_header'],
body: {
language: 'js',
capabilities: ['api.write'],
source: `
await ctx.api.object('crm_opportunity').update(input.id, {
next_step: 'Reviewed by manager'
});
return { id: input.id };
`,
},
refreshAfter: true,
};Add views and pages
- Put list and kanban definitions in the owning package's
views/—src/sales/views/,src/service/views/,src/revenue/views/orsrc/marketing/views/. - Put record pages and utility pages in that package's
pages/—src/sales/pages/orsrc/service/pages/today. - Export new metadata from the matching
index.tsfile. - Add user-visible labels to
src/sales/translations/{locale}.ts.
Verify
pnpm validate
pnpm typecheck
pnpm test