ComponentsButtons & ActionsButton

Buttons & Actions

Button

A simple rectangular button used across builder screens. It supports five action modes and intentionally executes actions only in preview/runtime so the builder canvas remains safe for selecting and dragging components.

Action modesnone · alert · navigate · url · back

One component covers static, messaging, routing, external link, and back behaviors.

Execution guardPreview mode only

Actions run only when isPreview=true, never on static canvas editing mode.

Code locationsComponent · Registry · Dimensions

Keep BuilderButton.tsx, registry props, and componentDimensions.ts aligned.

What it does

Four things worth knowing

Simple text-first action block

Renders a customizable rectangular button label with editable colors, border settings, typography, and sizing controls.

Five built-in action types

Supports none, alert, navigate-screen, open-url, and go-back via onPressAction.

Preview-only execution safety

Press actions are intentionally disabled in builder editing mode to prevent accidental navigation or URL opens while arranging components.

Canvas sizing must stay in sync

Drag box dimensions come from calculateComponentDimensions(‘button’, …), so sizing logic there must match the rendered button.

Code map: component logic in BuilderButton.tsx, builder-editable config in registry key button, and drag sizing in componentDimensions.ts case ‘button’.

Builder setup

Find it, drop it, wire the action

Where to find itAdd it to any actionable screen area

  1. Open the Builder component picker.
  2. Go to Buttons & ActionsButton.
  3. Drop it where the user should take the main next step.

Action wiringThree common setups

  1. Internal navigation: onPressAction=navigate-screen and actionData=<targetScreenId>.
  2. External URL: onPressAction=open-url and actionData=https://….
  3. Back behavior: onPressAction=go-back to use runtime back stack.
Category: Buttons & ActionsComponent: BuilderButtonRegistry key: buttonCanvas sizing: componentDimensions.ts
Props

Editable content, visuals, sizing, and behavior

PropTypeDefaultDescription
textstringRegistry defaultMain visible button label text.
backgroundColor, textColor, borderColor, borderWidth, borderRadius, fontFamily, fontSizestyleRegistry defaultsVisual styling for fill, text, border, radius, and typography.
widthPercent, heightnumber / select100, presetSizing controls for width (10–100) and preset height options.
onPressAction, actionDataselect / stringnone, emptyAction type and its payload (screen ID, URL, or alert text).
isPreview, onScreenNavigate, onGoBackruntimeInjectedPreview guard and callbacks used by action execution logic.
Toggles & colours

Make it yours

The button is intentionally lightweight. Most customization comes from text, colors, border styling, width percentage, and preset height selection.

PropDefaultWhat it controls
backgroundColor, textColorRegistry defaultsPrimary visual contrast and readability of the action.
borderColor, borderWidth, borderRadiusRegistry defaultsButton edge style, outline weight, and corner shape.
fontFamily, fontSizeRegistry defaultsTypography tone and emphasis for CTA label text.
widthPercent100Button width scale from compact actions to full-width CTAs.
heightPresetTap target height via allowed builder preset options.
Tips

Common mistakes to avoid

Button press does nothing on canvas

Expected behavior: actions are intentionally disabled outside preview mode to keep builder editing safe.

navigate-screen not working

Verify actionData contains a valid target screen ID and that runtime navigation callback is available.

Visual size and drag box mismatch

Check componentDimensions.ts button width/height calculations and keep them aligned with button render sizing.

Keep code changes synced

If props change in BuilderButton.tsx, update registry defaultProps/propDefinitions and keep button dimensions logic in sync.