Extension types

An extension adds one piece of UI to a record page: a button, a card, a tab or a dialog on a job, a customer, an invoice and other records. Each extension declares objects (the record types it appears on) and one of the four types below.

Record action

An entry in the record's "More Actions" menu, or a header button when primary.

Needslabel, onTrigger({ record, ui })
Optionalicon, primary: true
export default defineExtension({
	type: 'record-action',
	id: 'create-warranty',
	label: 'Create warranty',
	icon: 'shield-check',
	objects: ['job'],
	onTrigger: async ({ record, ui }) => {
		const ok = await ui.confirm({ title: 'Create a warranty for ' + record.title + '?' });
		if (ok) ui.toast('Warranty created', { tone: 'success' });
	},
});

App card

A card on the record's Overview, or in its Apps tab.

Needstitle, render(context)
Optionalicon, `location: 'overview'
import { defineExtension } from '@zuperpro/app-sdk';
import { DescriptionList } from '@zuperpro/app-sdk/react';

export default defineExtension({
	type: 'app-card',
	id: 'warranty-card',
	title: 'Warranty',
	icon: 'shield-check',
	objects: ['job'],
	render: (job) => (
		<DescriptionList items={[{ label: 'Customer', value: job.customerName }, { label: 'Status', value: job.status }]} />
	),
});

Record tab

A tab on the record page.

Needslabel, render(context)
Optionalicon
export default defineExtension({
	type: 'record-tab',
	id: 'acme-warranty-tab',
	label: 'Warranty',
	objects: ['job'],
	render: () => (
		<Card title="Coverage">
			<Text>Gold plan, 3 years</Text>
		</Card>
	),
});

Dialog

A dialog your app opens with ui.openDialog.

Needstitle, render({ record, input, close })
Optional`size: 'sm'
export default defineExtension({
	type: 'dialog',
	id: 'note-dialog',
	title: 'Add a note',
	objects: ['job'],
	render: ({ close }) => <NoteForm close={close} />,
});

// From a card, tab or action:
const result = await ui.openDialog<{ note: string }>('note-dialog');

See Dialog for DialogBody and DialogActions, the components that hold a dialog extension's content and footer buttons.


Did this page help you?