RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

  • Custom Components

    • Custom Components Overview
    • Component Visual Configuration
      • Optional Interfaces
        • ComponentDefGetter — Custom Form Definition
        • CategoryGetter — Custom Category
        • DescGetter — Custom Description
      • Config Struct Tags
        • component tag examples
      • Shared Node Pool (SharedNode)
      • Related Documentation
  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

Component Visual Configuration

Custom components define visual forms through Config struct tags. The visual editor (RuleGo-Editor) automatically renders the component configuration UI based on these tags.

# Optional Interfaces

Besides the core Node interface, components can implement the following optional interfaces to provide additional information:

# ComponentDefGetter — Custom Form Definition

Overrides the auto-generated component form configuration. Non-empty fields in the return value override the auto-generated values:

type ComponentDefGetter interface {
    Def() ComponentForm
}
1
2
3

Example — custom description and relation types:

func (x *MyNode) Def() types.ComponentForm {
    relationTypes := &[]string{types.Success, types.Failure, types.True, types.False}
    return types.ComponentForm{
        Label:         "My Component",
        Desc:          "This is a custom component",
        RelationTypes: relationTypes,
    }
}
1
2
3
4
5
6
7
8

# CategoryGetter — Custom Category

type CategoryGetter interface {
    Category() string
}
1
2
3

# DescGetter — Custom Description

type DescGetter interface {
    Desc() string
}
1
2
3

# Config Struct Tags

Custom component Config structs support the following tags for visual editor form rendering:

Tag Description Example
json Field name json:"delayMs"
label Display name label:"Delay (ms)"
desc Field description desc:"Delay time in milliseconds"
required Whether required required:"true"
component UI component type component:"{\"type\":\"select\",\"options\":[...]}"
ref Shared node association ref:"primary"

# component tag examples

Dropdown select:

RequestMethod string `json:"requestMethod" label:"Request Method"
    component:"{\"type\":\"select\",\"options\":[{\"label\":\"GET\",\"value\":\"GET\"},{\"label\":\"POST\",\"value\":\"POST\"}]}"`
1
2

Code editor:

JsScript string `json:"jsScript" label:"Script"
    component:"{\"type\":\"codeEditor\",\"language\":\"javascript\"}"`
1
2

# Shared Node Pool (SharedNode)

For components that need shared connections or resources (such as MQTT clients, database connection pools), you can use the shared node pool pattern. Multiple rule nodes reuse the same underlying connection instance, avoiding repeated creation.

Use the ref tag in the Config struct to identify the relationship between fields and the shared node:

type MqttClientNodeConfiguration struct {
    Server   string `json:"server" label:"Server Address" required:"true" ref:"primary"` // Reference field
    Username string `json:"username" label:"Username" ref:"shared"`                      // Provided by shared node
    Password string `json:"password" label:"Password" ref:"shared"`                      // Provided by shared node
    Topic    string `json:"topic" label:"Topic" required:"true"`                         // Component's own field
}
1
2
3
4
5
6
  • ref:"primary" — The identifier field for the ref:// reference address
  • ref:"shared" — Configuration field provided by the shared node, hidden when using references
  • No ref — Component's own business field, always displayed

# Related Documentation

  • Component Form Conventions — Complete form generation rules and endpoint component conventions
  • Get Component Configuration Form — ComponentForm and ComponentFormField complete field reference
  • Custom Components Overview — Component interfaces and development guide
Edit this page on GitHub (opens new window)
Last Updated: 2026/05/30, 11:18:53
Custom Components Overview
Dynamic Components

← Custom Components Overview Dynamic Components→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式