code-docs/plugins/actions/overview.md
Actions are functions executed in response to events. They power interactivity in Lowdefy apps.
Actions are:
blocks:
- id: button
type: Button
events:
onClick: # Event
- id: updateState # Action 1
type: SetState
params:
loading: true
- id: saveData # Action 2
type: Request
params:
requestId: saveUser
- id: navigate # Action 3
type: Link
params:
pageId: success
| Package | Purpose | Actions |
|---|---|---|
| @lowdefy/actions-core | Core actions | SetState, Request, Link, etc. |
| @lowdefy/actions-pdf-make | PDF generation | PdfMake |
Each action has:
- id: actionId # Unique ID within event
type: ActionType # Action type name
params: # Action parameters
key: value
skip: # Optional: skip condition
_state: skipAction
onError: # Optional: error handling
- id: handleError
type: Message
Event Triggered
│
▼
┌─────────────────────┐
│ For each action: │
├─────────────────────┤
│ 1. Evaluate skip │
│ 2. Evaluate params │
│ 3. Execute action │
│ 4. Handle errors │
└─────────────────────┘
│
▼
All actions complete
events:
onClick:
- id: adminAction
type: SetState
skip:
_not:
_user: isAdmin
params:
showAdminPanel: true
events:
onClick:
- id: saveData
type: Request
params:
requestId: save
onError:
- id: showError
type: Message
params:
content: Save failed
type: error
events:
onClick:
- id: validate
type: Validate
- id: save
type: Request
params:
requestId: save
- id: success
type: Message
params:
content: Saved!
- id: navigate
type: Link
params:
pageId: list
Each action can export a schema.js file describing its expected params shape. These schemas are collected at build time into plugins/actionSchemas.json.
When an ActionError occurs at runtime, the server validates the received params against the action's schema and produces a diagnostic ConfigError:
[ConfigError] Action "SetState" required param "value" is missing.
This is reactive validation — it only runs when an error is caught, not on every execution. See plugin-system.md for schema format details.
Actions run in order because:
Sequential execution prevents:
Parallel execution can be achieved with multiple events or custom endpoints.