Background component adds a customizable pattern (dots or lines) to your Vue Flow canvas.
Installation
Basic Usage
Props
The background pattern variant to display.
Gap between pattern elements. Can be a single number or
[gapX, gapY] array.Size of the pattern elements (radius for dots, thickness for lines).
Width of lines when using the
lines variant.Color of the pattern. Defaults to
#81818a for dots and #eee for lines.Deprecated: Use
color instead. Background pattern color.Deprecated: Set background color on
<VueFlow /> directly instead.Offset the pattern position. Can be a single number or
[offsetX, offsetY] array.X-coordinate offset for the background.
Y-coordinate offset for the background.
Deprecated: Height percentage of the background (1-100).
Deprecated: Width percentage of the background (1-100).
Unique identifier for the background pattern. Useful when using multiple Vue Flow instances on the same page.
Slots
Custom container for the SVG pattern element.
pattern
Custom pattern content. Use this to create completely custom background patterns.
Additional SVG content rendered after the background rect.
Examples
Custom Colors
Different Gap Sizes
Custom Pattern
With Offset
Multiple Instances
When using multiple Vue Flow instances on the same page, provide unique IDs to avoid pattern conflicts:The background pattern automatically scales with the viewport zoom level, ensuring a consistent visual appearance at any zoom.