Skip to content
  1. Extras
  2. PageBuilder
  3. Field types
  4. Free
  5. button

Field button

Version: Free.

Why this type

One field holds the three parts of a link: label, URL, and where it opens (label, url, target). The URL can keep UTM placeholders. The chunk turns that object into an <a> tag.

When to use

  • Primary hero or CTA button
  • Secondary link with target _blank
  • Label plus link without two fields

Tips

URL-only fits url. Multiple buttons use repeater with nested button or text+url.

Similar types

  • url for bare href
  • text + url for split layout control

Schema

json
{
  "name": "cta",
  "type": "button",
  "label": "Button",
  "tab": "Content",
  "width": 100,
  "active": true
}

Value

Object { label, url, target }.

Section data

Key cta in the section data:

json
{
  "cta": {
    "label": "Learn more",
    "url": "https://example.com",
    "target": "_blank"
  }
}

Chunk example

modx
<a class="pb-button" href="[[+cta.url]]" target="[[+cta.target]]">[[+cta.label]]</a>
fenom
<a class="pb-button" href="{$cta.url|pb_href|escape}" target="{$cta.target|escape}">{$cta.label|pb_text}</a>

Common properties

For fields with name that are stored in the section data:

KeyTypeRoleCMP
tabstringGroup subtitle in the inspectoryes
width25–100Field width as % of the row (flex)yes
descriptionstringHint under the labelyes
defaultanyInitial value for a new sectionyes
activeboolfalse hides the field in the inspectoryes
requiredboolRequired on publish (draft still saves)yes
  • Also: UTM placeholders in url.

See fields overview.

See also