Group component allows you to group multiple drawing elements together. Groups are essential for applying transformations, blend modes, and effects to multiple elements at once.
Basic Usage
Props
Child elements to group together
Creates a new layer for the group. Can be
true to create a simple layer, or a React element (like <Paint>) to apply effects to the layer.When set to true, the group will be drawn to an offscreen buffer before being composited onto the canvas.Array of transformations to apply to the group (translate, scale, rotate, skew)
Origin point for transformations
Clipping region for the group
If true, inverts the clipping region
Blend mode for compositing the group. See Blend Modes
Opacity of the group (0-1)
Layering
Groups with layers are useful for applying effects to multiple elements:Transformations
Apply transformations to all children in the group:Clipping
Restrict rendering to a specific region:Blend Modes
Apply blend modes to groups:Performance Considerations
- Groups with layers (
layerprop) create offscreen buffers, which can be expensive - Use layers only when necessary for effects or blend modes
- Simple groups without layers have minimal performance overhead
- Avoid deeply nested groups when possible