Overview
The group element allows you to group multiple elements together. This is particularly useful when used in combination with control flow properties likeif and loop to conditionally render or repeat multiple elements as a unit.
When to use:
- Apply conditional logic to multiple elements at once
- Loop over multiple elements together
- Organize related elements into logical sections
- Create reusable element blocks
Basic Example
Fields
The type of element. For group elements, this value must be
"group".An array of Elemental elements to group together. All elements in this array will be rendered together as a unit.
A condition that determines whether the entire group should be rendered. See Control Flow documentation for details.
An expression that allows the entire group to be repeated multiple times. See Control Flow documentation for details.
A reference identifier for the group. See Control Flow documentation for details.
An array of channel names. The group will only be rendered for the specified channels. See Control Flow documentation for details.
Examples & Variants
Conditional Group
Show or hide multiple elements based on a condition:Looping Group
Repeat a group of elements for each item in an array:Channel-Specific Group
Show different groups of elements for different channels:Nested Groups
Group elements within groups for complex structures:Organizing Sections
Use groups to organize different sections of your notification:Best Practices
- Use for conditional blocks: Group elements that should appear or disappear together
- Organize logically: Group related elements to improve template readability
- Combine with loops: Use groups to repeat multiple elements as a unit
- Avoid unnecessary nesting: Only nest groups when you need different conditions at different levels
Related Elements
- Control Flow - Learn about
if,loop,ref, andchannelsproperties - Channel Element - For channel-specific content customization
- Columns Element - For multi-column layouts
- Text Element - For text content within groups
- Action Element - For buttons and links within groups