
Block Fundamentals
- What are Blocks?
- Block Types
- Block Communication
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
Common Block Properties
All blocks share a set of common properties that can be configured in YAML:Required. Unique identifier for the block in your workspace.
Event fired when the block is initialized. Example:
myInitBlockEventEvent that triggers an update of the block. Example:
myUpdateBlockEventInit the block with an automation as endpoint. Example:
myAutomationThe difference with the event base init is that the automation will take query string in {{body}}
and the output will be used to upgrade the block. No need to emit an update event and to listen to
a updateOn event.CSS class name to apply to the block. Example:
block-classnameCustom CSS for styling the block.There is some private keywords to help you target your element:
Every selector you set will be automatically prexifed byWhen you set css, it override the default styles of the block. But maybe you
just want to keep the styles but add only something. You will use Finally, you may want to set styles on an element external to your block.
You can target outside it by using
:block is a shortcut to the unique generated class of your block. Use it to target the root of your block DOM.Every selector you set will be automatically prexifed by
:block to avoid polluting the page styles.You will need to use :block specifically if you set a dynamic stated class on your block:@import default::root:Conditional display expression. Block will only be shown if the expression evaluates to true.
Allows repeating the block for each item in an array.