Blocks
Build reusable UI components that communicate through events in the AI Builder framework
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.
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.
AI Builder provides several categories of blocks:
- Built-in Blocks: Core components provided by the platform
- Apps Store Blocks: Components from installed Apps provided by Prisme.ai
- Template Blocks: Pre-configured blocks within your workspaces for specific use cases
- Custom Blocks: Your own blocks created from the design system published on the App store
Each type serves different purposes in your application.
Blocks communicate through an event-driven model:
- Event Emission: Blocks emit events when something happens
- Event Listening: Blocks listen for events from other components
- Data Exchange: Events carry payloads with information
- Asynchronous Communication: Non-blocking interaction pattern
This communication model enables loose coupling between components.
Common Block Properties
All blocks share a set of common properties that can be configured in YAML:
Common Properties
Common Properties
Required. Unique identifier for the block in your workspace.
Event fired when the block is initialized. Example: myInitBlockEvent
Event that triggers an update of the block. Example: myUpdateBlockEvent
Name of the automation to associate with this block.
Identifier for the section containing this block. Example: myBlock
CSS class name to apply to the block. Example: block-classname
Custom CSS for styling the block. Uses :block
selector for the block root element.
Conditional display expression. Block will only be shown if the expression evaluates to true.
Allows repeating the block for each item in an array. Example: repeat on myArray
Variable name for the current item when using repeat. Example: myItem
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.
Configuration Options
Configuration Options
Optional. Form title.
Required. JSON Schema defining form fields and validation.
Optional. Event to trigger when form values change.
Optional. Event to trigger when form is submitted.
Optional. Text for the submit button.
Optional. If true, hides the submit button.
Optional. If true, disables the submit button.
Optional. Delay in ms before re-enabling submit button after submission.
Optional. Initial values for form fields.
Optional. Additional buttons to display.
Optional. If true, form starts in collapsed state.
Optional. If true, first field gets focus on form load.
Example YAML
Example YAML
Learn more about Form Block for advanced configuration: https://docs.prisme.ai/products/ai-builder/workspaces#json-schema-form
RichText Block
Display formatted text with support for Markdown and HTML.
Configuration Options
Configuration Options
The text content to display. Can be localized with language codes.
Optional. If true, content will be parsed as Markdown. Default: false
Optional. If true, allows HTML tags in content. Default: false
Optional. HTML tag to use for the container.
Example YAML
Example YAML
Action Block
Create interactive buttons and links.
Configuration Options
Configuration Options
Required. Action type: ‘external’, ‘internal’, ‘inside’, ‘event’, ‘script’, or ‘upload’.
Required. Target URL, event name, or script based on type.
Required. Button/link text or content.
Optional. Data to send with event.
Optional. If true, opens links in a new window.
Optional. For upload type, specifies accepted file types.
Optional. Confirmation dialog settings.
Optional. If true, disables the action.
Example YAML
Example YAML
DataTable Block
Display tabular data with sorting, filtering, and pagination.
Configuration Options
Configuration Options
Optional. Table title.
Required. Array of data objects to display.
Optional. Column configurations.
Optional. Pagination configuration.
Optional. Event to trigger when sorting changes.
Optional. Initial sort configuration.
Optional. Actions for selected rows.
Optional. Context menu items for rows.
Optional. Context menu items for column headers.
Optional. If true, makes the header sticky.
Optional. Data line update event.
Insert at least one discriminating variable in your event to identify the row to be updated. Ex: “update row $id”
Optional. Additional properties for the table.
Example YAML
Example YAML
Image Block
Display an image with optional caption.
Configuration Options
Configuration Options
Example YAML
Example YAML
Carousel Block
Display a slideshow of multiple blocks.
Configuration Options
Configuration Options
Example YAML
Example YAML
TabsView Block
Display content in tabbed interface.
Configuration Options
Configuration Options
Example YAML
Example YAML
Signin Block
Display a sign-in or sign-up form.
Configuration Options
Configuration Options
Example YAML
Example YAML
Toast Block
Display notification messages.
Configuration Options
Configuration Options
Event name that triggers the toast notification.
Example YAML
Example YAML
Using Toast
Using Toast
The toast block responds to events carrying a message configuration:
Hero Block
Display a hero section with title, lead text, and background image.
Configuration Options
Configuration Options
Example YAML
Example YAML
Footer Block
Display a page footer.
Configuration Options
Configuration Options
Required. Blocks to display in the footer.
Example YAML
Example YAML
BlocksList Block
Display a collection of blocks.
Configuration Options
Configuration Options
Example YAML
Example YAML
Breadcrumbs Block
Display navigation breadcrumbs.
Configuration Options
Configuration Options
Example YAML
Example YAML
Charts Block
Display data visualizations.
Configuration Options
Configuration Options
Example YAML
Example YAML
Marketplace Blocks
The following blocks are available after installing specific apps from the marketplace.
Dialog Box Block
Display an interactive chat interface.
Configuration Options
Configuration Options
Example YAML
Example YAML
Popover Block
Display content in a floating popover.
Configuration Options
Configuration Options
Example YAML
Example YAML
Block Event System
The event system is the core communication mechanism between blocks:
Event Types
Event Types
Event Types
Event Communication Pattern
Event Definition
Blocks define the events they will emit:
This creates an event on the system when the end user interacts with blocks
Event Subscription
Other automations register to receive specific events:
This tells the automation to listen for the specified event and call the appropriate handler when it occurs.
Advanced Block Features
Block Composition
Block Composition
Blocks can be composed from other blocks to create higher-level components:
- Container Blocks: Wrap and organize other blocks
- Composite Blocks: Combine multiple blocks into a cohesive component
- Layout Blocks: Control the arrangement of nested blocks
- Wrapper Blocks: Add functionality to existing blocks
Composition enables reuse and maintains separation of concerns.
Block Styling
Block Styling
Blocks can be styled through multiple approaches:
- CSS Editor: Direct CSS customization
- Built-in CSS: Keeping the default CSS
- CSS Classes: Predefined style sets
Consistent styling ensures a cohesive user experience.
Block Conditions
Block Conditions
Blocks can have conditional behavior based on various logical factors:
- Block Display Condition (if): Example: if MyCondition
- Repeat Block on Array: Example: repeat on MyTable
- Variable Name for Each Item: Example: MyVariable
Conditions enable dynamic, responsive interfaces.
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