Ligantic
Knowledge Base
Tutorials
Updates
Search Articles
Login
Free Sign Up
Home
Get Started
Tutorials
How-to guides
Reference
Explanation
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Browse documentation
Home
Get Started
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Docs
/

Button

Type identifier: button Category: Experience Blocks

Description

Interactive block that renders Text and Image children and triggers configured actions.

Schema Summary

The Button block has the fields below, plus one action shape:

  1. modern action config, or
  2. legacy Flow trigger config (compatibility)

Fields:

  • type: "button"
  • variant?: "solid" | "ghost" | "soft"
  • children: Array<text | image>
  • loadingChildren?: Array<text | image>
  • states? (array of state entries)

Action Configuration

Modern action (action):

  • kind: "flow" with flowId, triggerNodeId, inputMap, and optional onSuccess (see Flow Actions), or
  • kind: "preset" with preset (authAction), or
  • kind: "crud" with operation, optional target, and optional onSuccess

Legacy compatibility shape:

  • flowId, triggerNodeId, inputMap at block root

Flow Actions

A Flow action runs the Flow's trigger with the inputs from Input Map. The button shows its loading content until the run ends.

On Success sets what happens after the run succeeds. Nothing happens if the run fails or is cancelled.

  • None (default).
  • Reset: discards the unsaved changes of the Reset Target entity context. A batch entity context resets every entity context inside it. Without a target, the nearest ancestor entity context is reset.
  • Navigate: goes to a URL, an Experience, or an Auth Action.

For example, a sheet of draft cells can send its batch's changes to a Flow that saves them, then reset the batch so the cells are empty again; see Send Unsaved Changes to a Flow.

CRUD Actions

CRUD actions act on the targeted entity context, or on an editable row of a list, directly, without running a Flow. In the Studio editor, choose CRUD from the Action Type select to configure:

  • Operation: create, update, delete, or save. save upserts: it creates when the entity context is new and updates when loaded and dirty.
  • Target: an optional datum reference picker filtered to targets that can be saved: entity contexts over a Schema, batch entity contexts, and For Each items that are Records (see Editable Rows). A For Each item is not offered for create, because a row is already a Record. When omitted, the action targets the nearest ancestor entity context in the rendered subtree; it never targets a row, so to save a row, target its For Each item explicitly.
  • On Success: optional post-operation behaviour:

    • Reset — discards unsaved edits and clears any CRUD error on the entity context.
    • Refetch — reloads the target entity's data.
    • Navigate — navigates to a configured Experience link (URL, Experience, or Auth Action).

When the target resolves to an entity context that is in batch mode (collecting descendant entity contexts), CRUD behaviour is:

  • save iterates registered descendant entity contexts and saves each dirty entry. If no descendants are currently registered, this is a no-op success.
  • create, update, and delete are rejected for batch mode targets.

Properties

Property

Type

Required

Notes

id

string

Yes

Shared block identifier.

type

"button"

Yes

Block discriminator.

variant

"solid" | "ghost" | "soft"

No

Visual variant.

children

Array<text | image>

Yes

Primary child content.

loadingChildren

Array<text | image>

No

Loading-state content; when omitted, children are shown while loading.

action

Object (see Action Configuration)

Yes*

Required in modern shape.

flowId

string (cuid2)

Yes*

Required in legacy shape.

triggerNodeId

string

Yes*

Required in legacy shape.

inputMap

Record<string, string | datumReference>

Yes*

Required in legacy shape.

states

Array of states

No

Optional state-specific overrides.

The Button block also supports the shared style/layout/data props.

* One action shape is required: modern action or legacy flow fields.

States

State entries follow the shared state shape and support partial Button overrides.

Supported pseudo states:

  • hover
  • focus
  • active
  • disabled

The disabled state can also be driven by data: with it selected, + Add condition sets an activation condition. While the condition holds, the button is disabled (it can't be clicked) and shows the state's overrides. For example, a Save button can stay disabled until there are unsaved changes; see Show Unsaved Changes and Enable Save.

Minimal Valid Example

{
  "id": "btn-1",
  "type": "button",
  "children": [
    {
      "id": "txt-1",
      "type": "text",
      "text": "Submit"
    }
  ],
  "action": {
    "kind": "preset",
    "preset": "logout"
  }
}

Maximal Example

This example shows the Button-specific fields together with representative shared style, layout, responsive, and state properties. loadingChildren is optional; when it is omitted, the regular children render while the action is running.

{
  "id": "btn-submit-1",
  "type": "button",
  "name": "submit-button",
  "variant": "solid",
  "children": [
    {
      "id": "btn-submit-label",
      "type": "text",
      "name": "submit-label",
      "text": "Submit application",
      "htmlElement": "p",
      "color": "#ffffff",
      "fontSize": "14px",
      "fontWeight": "600",
      "textAlign": "center",
      "padding": "0 4px"
    },
    {
      "id": "btn-submit-icon",
      "type": "image",
      "name": "submit-icon",
      "src": "https://example.com/icons/arrow-right.png",
      "alt": "",
      "width": 16,
      "height": 16,
      "objectFit": "contain",
      "margin": "0 0 0 8px"
    }
  ],
  "loadingChildren": [
    {
      "id": "btn-submit-loading-label",
      "type": "text",
      "name": "submit-loading-label",
      "text": "Submitting...",
      "htmlElement": "p",
      "color": "#ffffff",
      "fontSize": "14px",
      "fontWeight": "600",
      "textAlign": "center"
    }
  ],
  "width": "200px",
  "height": "40px",
  "padding": "0 16px",
  "margin": "8px 0",
  "backgroundColor": "#2563eb",
  "borderWidth": "1px",
  "borderColor": "#1d4ed8",
  "borderRadius": "6px",
  "boxShadow": [
    {
      "color": "rgba(0, 0, 0, 0.12)",
      "offsetX": "0px",
      "offsetY": "1px",
      "blurRadius": "2px"
    }
  ],
  "display": "inline-flex",
  "direction": "row",
  "align": "center",
  "justify": "center",
  "gap": "8px",
  "transition": [
    {
      "property": "background-color",
      "duration": {
        "value": 150,
        "unit": "ms"
      },
      "timingFunction": "ease-out"
    }
  ],
  "breakBefore": "auto",
  "breakAfter": "avoid",
  "states": [
    {
      "id": "hover",
      "name": "Hover",
      "overrides": {
        "backgroundColor": "#1d4ed8",
        "borderColor": "#1e40af"
      }
    },
    {
      "id": "disabled",
      "name": "Disabled",
      "overrides": {
        "backgroundColor": "#93c5fd",
        "borderColor": "#93c5fd",
        "children": [
          {
            "id": "btn-submit-disabled-label",
            "type": "text",
            "text": "Submit application",
            "color": "#eff6ff"
          }
        ]
      }
    }
  ],
  "action": {
    "kind": "preset",
    "preset": "logout"
  }
}

Related pages

Experience Blocks Reference
This reference documents all currently defined Experience block types in Ligantic.
Page not found. It may have moved or may not be published.
Browse documentation