HOC SiteDokümantasyon

Button

Decoration and visibility use Dekorasyon ve görünürlük (BlockShell).

Call-to-action or named dataRequest trigger. Prefer sitemap routes for navigate. For forms/search use action runRequest|runMutation with requestName — request behavior (filters, fieldValues, resultWrites) lives on root.props.dataRequests. onSuccessActions navigate URLs resolve {{var:…}} / {{bind:…}} against a sync map that already includes that request’s resultWrites (and earlier updateVariables steps in the same list); unresolved tokens are skipped so they never become literal 404 paths — absolute https:// payment URLs work. Soft-nav feedback is opt-in: website settings navigationFeedback (progressBar, markControl, reuseLoadingText) default false; Button navigationFeedback is inherit|on|off and optional navigatingText (reuseLoadingText may fall back to loadingText). Bind {{bind:navigation.pending}} and {{bind:navigation.targetPath}} for custom indicators — nothing is painted unless authored. loadingText/successText/errorText update the visible button label for named requests and a visually hidden role="status" live region (not a second visible status line). resetOnSuccess (default true for runMutation) clears request field variables after a short success display. Client validation blocks empty required fields via native validity before the request runs (does not set request error / errorText). A single set-variable button whose value equals the current variable is pressed (aria-pressed and data-selected). The value may be a literal or {{var:item.field}}. Two or more buttons that set the same variable are a radiogroup; the selected one has aria-checked and data-selected (not aria-pressed), and arrow keys move the selection. Fill and outline chrome come from appearance.variant plus decoration background and border. Compact nav/footer links use appearance.variant "text" (default) — there is no stored "link" variant. Labeled text buttons have 0 intrinsic padding and no ButtonBlock min-height or touch-target floor; vertical size follows typography.size (floor 12px). Filled/outline add 12px vertical padding. Keep shell padding off for compact links; shell padding or heightStatic enlarges the control. Icons live as {{icon:…}} chips in text (not a separate icon prop). Icon-only controls get an accessible name from ariaLabel (localizable), else a derived label (social brands, Menu for bars-*, Theme for theme action). Locale actions never rewrite the button face; the authored text stays exactly as written, and localeLabelMode only labels the rows of a locale menu. Modal toggles set aria-expanded. A navigate button whose href matches the open page (ignoring a trailing slash and the locale prefix) sets aria-current="page" and data-selected. Selection paints nothing on its own: style it by authoring a selected decoration overlay (or an active text color). Variable radiogroup buttons are left unchanged. Optional iconSize / iconGap (px) override auto icon scale (~0.85× typography.size) and gap. For non-stretch CTAs keep shell.box.size.width.mode on fitContent (ButtonBlock defaults include this).

Examples

Primary CTA

{
  "content": {
    "text": [
      {
        "if": "*",
        "is": "Create thread"
      }
    ]
  },
  "action": {
    "url": "/categories/[id]/new"
  }
}

Run search request

{
  "content": {
    "text": [
      {
        "if": "*",
        "is": "Search"
      }
    ]
  },
  "action": {
    "kind": [
      {
        "if": "*",
        "is": "runRequest"
      }
    ],
    "requestName": [
      {
        "if": "*",
        "is": "searchX"
      }
    ],
    "loadingText": [
      {
        "if": "*",
        "is": "Searching…"
      }
    ]
  }
}

Set a variable from the current row

{
  "content": {
    "text": [
      {
        "if": "*",
        "is": "{{var:item}}"
      }
    ]
  },
  "action": {
    "kind": [
      {
        "if": "*",
        "is": "updateVariables"
      }
    ],
    "variableUpdates": [
      {
        "variableId": "size",
        "op": "set",
        "value": "{{var:item}}"
      }
    ]
  }
}

Icon-only menu toggle

{
  "ariaLabel": [
    {
      "if": "*",
      "is": "Menu"
    }
  ],
  "content": {
    "text": [
      {
        "if": "*",
        "is": "{{icon:bars-3}}"
      }
    ]
  },
  "action": {
    "kind": [
      {
        "if": "*",
        "is": "modal"
      }
    ],
    "modalId": [
      {
        "if": "*",
        "is": "ModalBlock-header-menu"
      }
    ]
  }
}

Fields

content

text

Button label. Mix literal text with {{var:id}}, {{bind:id}}, and {{icon:iconId}} chips. The icon picker appends an icon chip at the end; drag chips in the label to reposition. An older icon prop is migrated into a leading {{icon:…}} chip on design write / editor mount.

content: {
  text: [{ if: "*", is: "Browse {{icon:arrow-right}}" }]
}

ariaLabel

Accessible name for icon-only buttons/links. Overrides icon-derived labels. Ignored when visible text is present.

ariaLabel: [{ if: "*", is: "Menu" }]

typography

align

Horizontal text alignment (typography.align). On a heading, an explicit left is stored and pulls the block to the start of a centered flex parent. Omitting it keeps the parent alignment. Also used as FlexList/Row cross-axis alignment (layout.align).

Options: left, center, right

typography: {
  align: [{ if: "*", is: "center" }]
}

size

Font size in px. Authored typography.size ([{ if, is }], including { bp } for responsive type). Media CSS owns --btn-font-size when the leaf includes breakpoint conditions.

typography: {
  size: [{ if: [{ bp: "mobile" }], is: 12 }, { if: "*", is: 20 }]
}

lineHeight

Label line-height in px. Unset inherits from theme/parent; paints --btn-line-height on the label.

typography: {
  lineHeight: [{ if: "*", is: 24 }]
}

letterSpacing

Letter Spacing.

textTransform

Text Transform.

whiteSpace

Label white-space: "normal", "nowrap", or "pre-wrap" (default — keeps authored newlines, e.g. address buttons).

Options: normal, nowrap, pre-wrap

typography: {
  whiteSpace: [{ if: "*", is: "nowrap" }]
}

weight

Numeric font weight (typography.weight / CSS font-weight).

typography: {
  weight: [{ if: "*", is: 600 }]
}

family

Font family (typography.family). A theme token (theme-heading, theme-body, theme-mono), a rich-text font id, a CSS generic family (sans-serif, serif, monospace, system-ui, ui-sans-serif, cursive, fantasy), or a comma-separated stack.

typography: {
  family: [{ if: "*", is: "theme-heading" }]
}

italic

When true, renders the text in italic style.

typography: {
  italic: [{ if: "*", is: false }]
}

underline

When true, renders an underline on the text.

typography: {
  underline: [{ if: "*", is: false }]
}

appearance

appearance

Visual style: "filled", "outline", or "text" (link-style chrome; there is no "link" variant). Stored at appearance.variant. Text + label uses 0 padding and no min-height; filled/outline add 12px vertical padding. Fill and outline also use decoration background and border.

Options: filled, outline, text

appearance: [{ if: "*", is: "text" }]

iconSize

Optional icon size in px. When omitted, icons auto-scale to ~0.85× typography.size.

appearance: {
  iconSize: [{ if: "*", is: 20 }]
}

iconGap

Optional gap between icon chips and text in px. When omitted, uses a font-based gap.

appearance: {
  iconGap: [{ if: "*", is: 8 }]
}

color

textColor

Foreground text color. One authored color leaf: * is light, { theme: "dark" } is dark, and { on } (hover, active, focus, selected) is the interaction.

textColor: [
  { if: [{ theme: "dark" }], is: "#f9fafb" },
  { if: "*", is: "#111827" }
]

action

action

See shared option catalog action.

Options: navigate, copyEntryLink, shareSocial, websiteUserSignOut, notifications, updateVariables, runRequest, runMutation, modal, locale, theme, requestNextPage, requestPrevPage, sliderPrev, sliderNext, sliderGoTo, consentCookies, consentPush, consentAll

action: [{ if: "*", is: "navigate" }]

url

Link value stored at action.url. A string, or { url, params?, entryId?, routePageId? }.

entryId plus routePageId build the public URL from the route pattern and the entry. The last [param] is the entry. Earlier [relation.field] segments come from that entry, including {{var:item.id}} in a repeated list.

action: {
  url: { url: "catalogue/[slug]", params: { slug: "baby-wipes" }, entryId, routePageId }
}

modalId

When action is modal, the target ModalBlock’s stable props.id. Renaming the modal does not change this id. Missing targets no-op at runtime.

action: {
  modalId: [{ if: "*", is: "ModalBlock-abc123" }]
}

variableUpdates

Stored under the action group next to action updateVariables. Each entry is { variableId, op, value }. op is set, clear, add, or subtract. Number add and subtract clamp to 1…pageCount when that variable pages a list. value may be a literal or a whole token such as {{var:item}}; the click resolves tokens before writing the variable.

action: {
  variableUpdates: [{ variableId: "size", op: "set", value: "{{var:item}}" }, { variableId: "page", op: "add", value: 1 }]
}

localeTarget

When action is locale: next cycles locales, specific jumps to targetLocale, menu opens a language list whose rows use localeLabelMode. The button face keeps the authored text in every mode. With ≤1 enabled locale, menu falls through to next.

Options: next, specific, menu

action: {
  localeTarget: [{ if: "*", is: "menu" }]
}

targetLocale

When localeTarget is specific, the BCP-47 locale to switch to.

action: {
  targetLocale: [{ if: "*", is: "nl-BE" }]
}

localeLabelMode

Locale menu row labels: code (default) or nativeName. The button face always uses the authored text; this setting never replaces it.

Options: code, nativeName

action: {
  localeLabelMode: [{ if: "*", is: "nativeName" }]
}

requestName

Named dataRequest for runRequest/runMutation.

action: {
  requestName: [{ if: "*", is: "searchX" }]
}

loadingText

Label while the named request is loading.

action: {
  loadingText: [{ if: "*", is: "Searching…" }]
}

successText

Label after a successful run.

action: {
  successText: [{ if: "*", is: "Done" }]
}

errorText

Label when the named request fails.

action: {
  errorText: [{ if: "*", is: "Try again" }]
}

resetOnSuccess

When true (default for runMutation), clear request field variables after a short delay. Success text still displays for several seconds either way. When false, keep field values.

action: {
  resetOnSuccess: [{ if: "*", is: false }]
}

Default props

{
  "shell": {
    "box": {
      "size": {
        "width": {
          "mode": [
            {
              "if": "*",
              "is": "fitContent"
            }
          ]
        }
      }
    },
    "visibility": [
      {
        "if": "*",
        "is": true
      }
    ],
    "anchor": {
      "anchorId": [
        {
          "if": "*",
          "is": ""
        }
      ],
      "anchorKey": [
        {
          "if": "*",
          "is": ""
        }
      ]
    },
    "pointerEvents": [
      {
        "if": "*",
        "is": "auto"
      }
    ]
  },
  "content": {
    "text": [
      {
        "if": "*",
        "is": "Button"
      }
    ]
  },
  "typography": {
    "align": [
      {
        "if": "*",
        "is": "left"
      }
    ],
    "size": [
      {
        "if": "*",
        "is": 18
      }
    ],
    "weight": [
      {
        "if": "*",
        "is": 600
      }
    ],
    "family": [
      {
        "if": "*",
        "is": "theme-heading"
      }
    ],
    "italic": [
      {
        "if": "*",
        "is": false
      }
    ],
    "underline": [
      {
        "if": "*",
        "is": false
      }
    ]
  },
  "appearance": {
    "variant": [
      {
        "if": "*",
        "is": "text"
      }
    ],
    "color": {
      "text": [
        {
          "if": "*",
          "is": ""
        }
      ]
    }
  },
  "action": {
    "kind": [
      {
        "if": "*",
        "is": "navigate"
      }
    ],
    "openInNewTab": [
      {
        "if": "*",
        "is": false
      }
    ],
    "copiedText": [
      {
        "if": "*",
        "is": "Copied"
      }
    ],
    "socialNetwork": [
      {
        "if": "*",
        "is": "whatsapp"
      }
    ],
    "returnUrl": [
      {
        "if": "*",
        "is": "/"
      }
    ],
    "unreadBadge": [
      {
        "if": "*",
        "is": true
      }
    ]
  }
}