Blocks are reusable UI components that serve as the building blocks for creating interactive interfaces in AI Builder. They encapsulate functionality, emit and listen for events, and can be assembled to create complete user experiences.

Block Fundamentals

Blocks are modular UI components with specific purposes:

  • Self-contained: Each block encapsulates specific functionality
  • Reusable: Can be used across multiple pages and workspaces
  • Configurable: Customizable through properties and settings
  • Interactive: Respond to user actions and system events
  • Event-driven: Communicate with other components through events

Blocks follow the BlockProtocol.org standard, ensuring consistency and interoperability.

Common Block Properties

All blocks share a set of common properties that can be configured in YAML:

Built-in Blocks Library

AI Builder includes a comprehensive library of built-in blocks. Here’s a detailed reference for each block with its specific YAML configuration.

Form Block

Display an interactive form with validation.

RichText Block

Display formatted text with support for Markdown and HTML.

Action Block

Create interactive buttons and links.

DataTable Block

Display tabular data with sorting, filtering, and pagination.

Image Block

Display an image with optional caption.

Display a slideshow of multiple blocks.

TabsView Block

Display content in tabbed interface.

Signin Block

Display a sign-in or sign-up form.

Toast Block

Display notification messages.

Hero Block

Display a hero section with title, lead text, and background image.

Display a page footer.

BlocksList Block

Display a collection of blocks.

Display navigation breadcrumbs.

Charts Block

Display data visualizations.

Marketplace Blocks

The following blocks are available after installing specific apps from the marketplace.

Dialog Box Block

Display an interactive chat interface.

Popover Block

Display content in a floating popover.

Block Event System

The event system is the core communication mechanism between blocks:

Event Types

Event Communication Pattern

1

Event Definition

Blocks define the events they will emit:

- slug: Action
  text: Subscribe
  type: event
  value: user-subscribe
  payload:
    user: id
    product: productId

This creates an event on the system when the end user interacts with blocks

2

Event Subscription

Other automations register to receive specific events:

when:
  events:
    - user-subscribe
  endpoint: false

This tells the automation to listen for the specified event and call the appropriate handler when it occurs.

Advanced Block Features

Block Best Practices

Single Responsibility

Design blocks to do one thing well:

    Focus on a specific UI function

    Avoid creating overly complex blocks

    Split complex functionality into multiple blocks

    Create specialized blocks for specific use cases

Clear Naming

Use consistent, descriptive naming:

    Choose clear, descriptive block names

    Use consistent terminology across blocks

    Establish naming conventions for properties and events

    Document the purpose of each block

Robust Error Handling

Design blocks to handle failures gracefully:

    Validate inputs and handle edge cases

    Provide clear error states and messages

    Implement fallback behavior for missing data

    Log issues for troubleshooting

Accessibility

Ensure blocks work for all users:

    Follow WCAG guidelines for accessibility

    Support keyboard navigation

    Include screen reader compatible markup

    Maintain sufficient color contrast

Responsive Design

Optimize blocks for all device sizes:

    Test across different screen sizes

    Implement responsive layouts

    Adjust content for mobile displays

    Use relative units for sizing

Performance Optimization

Keep blocks efficient and responsive:

    Minimize unnecessary renders

    Optimize heavy operations

    Implement loading states for async operations

    Use lazy loading where appropriate

Next Steps