Portal Community

What Is an Action Library?

An action library is an npm package that:

Once installed and registered, any form schema in any tenant can reference the library's action types in its actions[] array — no additional code required.

Why Build Action Libraries?

Code Reuse

Write the "Approve via Docusign" handler once. Use it in 50 different forms without copying code.

Team Distribution

A shared library installed by your team provides consistent behavior across all forms in a product area.

Marketplace Publishing

Publish to MarketHub for other tenants to install. Action libraries are first-class InstallHub packages.

Versioning

Semantic versioning on npm. Fix a bug in the library and all forms using it get the fix on next install.

Library vs Inline Custom Action

AspectInline Custom (Guide 2)Action Library (this guide)
Handler locationIn your app's codebaseSeparate npm package
ReusabilitySingle applicationAny application that installs the package
DistributionVia your app deploymentnpm / InstallHub / MarketHub
VersioningYour app versionIndependent semver
Best forOne-off or app-specific logicShared business actions across teams

The Registration Pattern

Every action library follows the same three-step registration pattern:

1

Implement the handler

Write a function with signature (context: FormActionContext) => Promise<void>.

2

Register with a type key

Call registerFormAction('my-type', handler) during app initialisation.

3

Reference in form schema

Use "type": "custom", "config": { "handlerType": "my-type" } in any form.

Minimal Library Example

// src/index.ts — the library's entry point
import { registerFormAction } from '@atlas-forms/control-registry-js';
import type { FormActionContext } from '@atlas-forms/types-js';

const sendSlackNotification = async (ctx: FormActionContext): Promise<void> => {
  const { formValues, config } = ctx;
  await slackApi.send({
    channel: config?.channel ?? '#forms',
    text: `Form submitted: ${JSON.stringify(formValues)}`
  });
  ctx.complete();
};

// Call this once at app startup
export function registerSlackActions(): void {
  registerFormAction('slack-notify', sendSlackNotification);
}

// In your app's main.tsx
import { registerSlackActions } from '@myorg/atlas-slack-actions';
registerSlackActions();
Prerequisite Read Guide 2: Custom Actions before continuing. This guide assumes you understand the FormActionContext interface and the inline custom action pattern.