code-docs/plugins/actions/core.md
Core actions for Lowdefy. The primary action package included by default.
| Action | Purpose |
|---|---|
SetState | Modify page state |
SetGlobal | Modify global state |
Request | Execute data request |
CallAPI | Call custom endpoint |
Link | Navigate to page |
Login | Trigger login |
Logout | Trigger logout |
DisplayMessage | Show notification |
Validate | Validate form |
Reset | Reset state |
ResetValidation | Clear validation errors |
CallMethod | Call block method |
CopyToClipboard | Copy text to clipboard |
ScrollTo | Scroll to element |
SetFocus | Focus element |
Wait | Delay execution |
Fetch | Client-side fetch |
Throw | Throw error |
UpdateSession | Refresh auth session |
GeolocationCurrentPosition | Get GPS location |
Modify page state:
- id: update
type: SetState
params:
name: John # Simple value
count: # Dynamic value
_sum:
- _state: count
- 1
user.name: # Nested path
_event: value
# Set value
params:
field: value
# Set from event
params:
inputValue:
_event: value
# Merge object
params:
_object.assign:
- _state: formData
- newField: value
Modify global (cross-page) state:
- id: setTheme
type: SetGlobal
params:
theme: dark
Execute a data request:
- id: getData
type: Request
params:
requestId: fetchUsers
# Optional: override request params
payload:
filter:
_state: searchQuery
events:
onClick:
- id: setLoading
type: SetState
params:
loading: true
- id: fetch
type: Request
params:
requestId: getData
- id: clearLoading
type: SetState
params:
loading: false
Call custom API endpoint:
- id: processData
type: CallAPI
params:
endpointId: processOrder
payload:
orderId:
_state: orderId
Navigate to another page:
- id: goToDetails
type: Link
params:
pageId: user-details
input:
userId:
_state: selectedUserId
# External URL
- id: goExternal
type: Link
params:
url: https://example.com
newTab: true
| Param | Purpose |
|---|---|
pageId | Target page ID |
url | External URL |
input | Data to pass |
urlQuery | Query parameters |
newTab | Open in new tab |
home | Go to home page |
back | Go back |
# Trigger login
- id: login
type: Login
# Trigger logout
- id: logout
type: Logout
params:
redirect: /goodbye
Show toast notification:
- id: notify
type: DisplayMessage
params:
content: Operation successful!
type: success # success, error, warning, info
duration: 3 # seconds
Validate form inputs:
- id: validateForm
type: Validate
params:
blockIds: # Optional: specific blocks
- email
- password
If validation fails, subsequent actions are skipped.
Reset state to initial values:
- id: clearForm
type: Reset
Clear validation errors:
- id: clearErrors
type: ResetValidation
Call a block's method:
- id: submitForm
type: CallMethod
params:
blockId: myForm
method: submit
args:
- option1
Copy text to clipboard:
- id: copy
type: CopyToClipboard
params:
text:
_state: shareLink
message: Link copied!
Scroll to element or position:
- id: scrollToTop
type: ScrollTo
params:
top: 0
- id: scrollToElement
type: ScrollTo
params:
blockId: results
Focus an input:
- id: focusInput
type: SetFocus
params:
blockId: emailInput
Delay before next action:
- id: delay
type: Wait
params:
ms: 1000 # milliseconds
Client-side HTTP request (no secrets):
- id: fetchExternal
type: Fetch
params:
url: https://api.example.com/data
method: GET
Throw an error (stops action chain):
- id: checkCondition
type: Throw
skip:
_state: isValid
params:
message: Validation failed
Refresh auth session:
- id: refreshSession
type: UpdateSession
Get user's GPS location:
- id: getLocation
type: GeolocationCurrentPosition
params:
stateKey: userLocation # Where to store result