ObjectStackObjectStack

Action

Action protocol schemas

Action Parameter Schema

Defines inputs required before executing an action.

Two declaration modes:

  1. Field-backed (preferred) — reference an existing object field; the

runtime resolves the field's label (i18n), type, validation rules,

options, placeholder, help text, and widget mapping from object

metadata. Cross-object references use objectOverride.


params: [

\{ field: 'email' \},                                 // same object

\{ field: 'role', objectOverride: 'sys_member' \},    // different object

]
  1. Inline (legacy / bespoke) — declare name, label, type etc.

inline when no matching object field exists. Inline values may also be

used alongside field to override individual properties.

name is required unless field is provided (in which case it defaults

to the field name and is used as the request-body key).

Source: packages/spec/src/ui/action.zod.ts

TypeScript Usage

import { Action, ActionAi, ActionLocation, ActionParam, ActionType } from '@objectstack/spec/ui';
import type { Action, ActionAi, ActionLocation, ActionParam, ActionType } from '@objectstack/spec/ui';

// Validate data
const result = Action.parse(data);

Action

Properties

PropertyTypeRequiredDescription
namestringMachine name (lowercase snake_case)
labelstringDisplay label
objectNamestringoptionalTarget object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().
iconstringoptionalIcon name
locationsEnum<'list_toolbar' | 'list_item' | 'record_header' | 'record_more' | 'record_related' | 'record_section' | 'global_nav'>[]optionalLocations where this action is visible
componentEnum<'action:button' | 'action:icon' | 'action:menu' | 'action:group'>optionalVisual component override
typeEnum<'script' | 'url' | 'modal' | 'flow' | 'api' | 'form'>optionalAction functionality type
targetstringoptionalURL, Script Name, Flow ID, or API Endpoint. Supports ${param.X} and ${ctx.X} interpolation.
openInEnum<'self' | 'new-tab'>optionalFor type:'url' — where to open target. 'new-tab' opens a new browser tab; 'self' navigates in place. When omitted, external/absolute URLs open in a new tab and relative URLs navigate in place. Static execution option — keep it OUT of params (which is user-input-collection only).
bodyObject | ObjectoptionalAction body — expression (L1) or sandboxed JS (L2). Only used when type is script.
executestringoptional@deprecated — Use target instead. Auto-migrated to target during parsing.
paramsObject[]optionalInput parameters required from user
variantEnum<'primary' | 'secondary' | 'danger' | 'ghost' | 'link'>optionalButton visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)
ordernumberoptionalSort order within a location group (lower = higher). Promotes/demotes an action toward the record_header primary button; stable, so actions without order keep their registration order.
confirmTextstringoptionalConfirmation message before execution
successMessagestringoptionalSuccess message to show after execution
errorMessagestringoptionalError message to show when the action fails (overrides the raw error).
refreshAfterbooleanoptionalRefresh view after execution
undoablebooleanoptionalOffer an Undo affordance after this single-record update action succeeds.
resultDialogObjectoptionalRender API response in a one-shot reveal dialog (suppresses successMessage when set).
visiblestring | ObjectoptionalVisibility predicate (CEL).
requiresFeatureEnum<'twoFactor' | 'passkeys' | 'magicLink' | 'organization' | 'multiOrgEnabled' | 'degradedTenancy' | 'oidcProvider' | 'sso' | 'ssoEnforced' | 'deviceAuthorization' | 'admin' | 'phoneNumber' | 'phoneNumberOtp'>optionalPublic auth feature flag gating this action; lowered into visible at parse time.
disabledboolean | string | ObjectoptionalBoolean or predicate (CEL) — action is disabled when TRUE.
requiredPermissionsstring[]optional[ADR-0066 D4] Capabilities required to invoke this action (server-enforced 403 + UI hide/disable).
shortcutstringoptionalKeyboard shortcut to trigger this action (e.g., "Ctrl+S")
bulkEnabledbooleanoptionalWhether this action can be applied to multiple selected records
aiObjectoptionalAI exposure (opt-in). Set ai.exposed=true + ai.description to make this callable by agents.
recordIdParamstringoptionalBody key to inject the row id into when running from a list_item context.
recordIdFieldstringoptionalRow field whose value seeds recordIdParam. Defaults to "id".
bodyShapestring | ObjectoptionalBody wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.
methodEnum<'POST' | 'PATCH' | 'PUT' | 'DELETE'>optionalHTTP method for type:"api" actions. Defaults to POST.
bodyExtraRecord<string, any>optionalConstant body fields merged into the API request (applied last; overrides user params).
modeEnum<'create' | 'edit' | 'delete' | 'custom'>optionalSemantic mode of the action.
opensInNewTabbooleanoptionalOpen the action result in a new tab. The renderer pre-opens the tab synchronously on click (popup-blocker-safe) and navigates it to the handler's redirectUrl.
newTabUrlstringoptionalDirect new-tab URL template ({recordId} placeholder). When set with opensInNewTab, the renderer navigates the pre-opened tab here immediately — no action POST. The endpoint must enforce auth itself.
timeoutnumberoptionalMaximum execution time in milliseconds for the action
ariaObjectoptionalARIA accessibility attributes

ActionAi

Properties

PropertyTypeRequiredDescription
exposedbooleanExpose this action to AI agents. Requires description when true.
descriptionstringoptionalLLM-facing description (≥40 chars). Required when exposed.
categoryEnum<'data' | 'action' | 'flow' | 'integration' | 'vector_search' | 'analytics' | 'utility'>optionalTool category override (defaults to "action").
paramHintsRecord<string, Object>optionalPer-parameter AI hints keyed by param name.
outputSchemaRecord<string, any>optionalJSON Schema for the action return value.
requiresConfirmationbooleanoptionalOverride HITL confirmation for AI invocations.

ActionLocation

Allowed Values

  • list_toolbar
  • list_item
  • record_header
  • record_more
  • record_related
  • record_section
  • global_nav

ActionParam

Properties

PropertyTypeRequiredDescription
namestringoptional
fieldstringoptionalSnake case identifier (lowercase with underscores only)
objectOverridestringoptionalSnake case identifier (lowercase with underscores only)
labelstringoptionalDisplay label (plain string; i18n keys are auto-generated by the framework)
typeEnum<'text' | 'textarea' | 'email' | 'url' | 'phone' | 'password' | 'secret' | 'markdown' | 'html' | 'richtext' | 'number' | 'currency' | 'percent' | 'date' | 'datetime' | 'time' | 'boolean' | 'toggle' | 'select' | 'multiselect' | 'radio' | 'checkboxes' | 'lookup' | 'master_detail' | 'tree' | 'user' | 'image' | 'file' | 'avatar' | 'video' | 'audio' | 'formula' | 'summary' | 'autonumber' | 'composite' | 'repeater' | 'record' | 'location' | 'address' | 'code' | 'json' | 'color' | 'rating' | 'slider' | 'signature' | 'qrcode' | 'progress' | 'tags' | 'vector'>optional
requiredbooleanoptional
optionsObject[]optional
placeholderstringoptional
helpTextstringoptional
defaultValueanyoptional
defaultFromRowbooleanoptional
visiblestring | ObjectoptionalParam visibility predicate (CEL); omits the param when false.
requiresFeatureEnum<'twoFactor' | 'passkeys' | 'magicLink' | 'organization' | 'multiOrgEnabled' | 'degradedTenancy' | 'oidcProvider' | 'sso' | 'ssoEnforced' | 'deviceAuthorization' | 'admin' | 'phoneNumber' | 'phoneNumberOtp'>optionalPublic auth feature flag gating this param; lowered into visible at parse time.

ActionType

Allowed Values

  • script
  • url
  • modal
  • flow
  • api
  • form

On this page