Inner Components
relation-graph includes composable built-in UI components for editor-like graph products: toolbar, minimap, node/line editors, connect-point helpers, and more.
1. Usage Principles
RelationGraphhandles core rendering and interaction.- Inner components enhance editing and operation workflows.
- Most of them are mounted in the
viewslot.
2. Common Components Overview
| Component | Purpose | Common props/events |
|---|---|---|
RGToolBar |
toolbar (zoom, center, fullscreen, etc.) | direction, positionH, positionV |
RGMiniView |
minimap / overview | position, width, height |
RGEditingReferenceLine |
drag alignment guides | showText, adsorption |
RGEditingNodeController |
host for active-node editing UI | default slot for RGEditingResize etc. |
RGEditingResize |
resize handles for node editing | disableResizeWidth, disableResizeHeight |
RGEditingLineController |
line editing (vertex/path/text) | textEditable, pathEditable, onLineTextChanged etc. |
RGEditingConnectController |
junction-point selector during connect/reconnect | no required props |
RGConnectTarget |
turn any element into a connect target/source | targetId, junctionPoint, targetData, lineTemplate etc. |
3. Typical Mounting Pattern (Vue3)
<template>
<RelationGraph :options="graphOptions">
<template #view>
<RGToolBar direction="v" positionH="right" positionV="center" />
<RGMiniView position="br" width="180px" height="120px" />
<RGEditingReferenceLine :showText="true" :adsorption="true" />
<RGEditingNodeController>
<RGEditingResize />
</RGEditingNodeController>
<RGEditingLineController :textEditable="true" :pathEditable="true" />
<RGEditingConnectController />
</template>
</RelationGraph>
</template>
<script setup lang="ts">
const graphOptions = {
showToolBar: false // disable default toolbar, mount RGToolBar manually
};
</script>
4. RGToolBar vs Default Toolbar
When showToolBar: true, relation-graph renders the default toolbar.
For custom placement and composition:
- Set
options.showToolBar = false - Mount
RGToolBarinviewslot
5. RGMiniView Layout Tips
- Common position:
position="br"(bottom-right) - Use fixed size (for example
180x120) - Reduce minimap size on mobile to avoid blocking main interactions
6. Recommended Editor Bundle
For graph editors, add components incrementally:
RGEditingReferenceLine(alignment assist)RGEditingNodeController + RGEditingResize(node edit)RGEditingLineController(line edit)RGEditingConnectController(junction-point selection)
7. RGConnectTarget Essentials
RGConnectTarget makes any element connectable inside nodes or on canvas:
targetIdidentifies the target endpointjunctionPointcontrols the endpoint side (left/right/top/bottom/border/ltrb/tb/lr)lineTemplatecan inject default style/business fields for new lines
8. Event Integration
Inner editing components are commonly paired with:
beforeCreateLine: validate before line creationonLineBeCreated: finalize and add line to graphonResizeStart/beforeNodeResize/onResizeEnd: node-resize lifecycleonLineVertexDropped: line endpoint drop completion
9. Practical Advice
- Enable components only when needed.
- Keep business rules in event handlers, not in view-only components.
- For complex editors, combine toolbar/property panels with
RGHooksstate for consistent UI behavior.