Flower Docs
  • OpenFlower overview
    • The "Hello World" tutorial
  • Videos
    • OpenFlower in 100 seconds
  • 🆕Setup and run
    • Cloud & Private Cloud
    • Self-hosting
      • Access local database or API
      • Google Cloud Platform
      • Heroku
      • Migration from Openblocks
      • Update MongoDB Versions
      • OpenFlower Version Update
      • Traefik loadbalancer
      • SMTP Server
    • Security
  • 🏨Workspaces & Teamwork
    • Workspaces
    • Members and Groups
    • Permissions for Resources
    • OAuth
      • KeyCloak
      • Google
      • GitHub
      • Generic OAuth Provider
    • Query library
    • OpenFlower Marketplace
  • ✨Build Applications
    • Create a new App
      • Modules
      • Version and Release Management
    • App Editor
      • Visual Components
        • Common Component Settings
        • File upload
        • Charts and graphs
        • Image
        • Option lists
        • List View
        • Drawer
        • Google Maps
        • Table
        • Messages / Toast
        • Calendar
      • Date handling
      • Bulk Editing
      • Layers
      • Data selection & Javascript
      • Use Markdown
      • Keyboard shortcuts
    • App Navigation
    • App Interaction
      • Event handlers
    • Themes & Styling
      • Design an efficient and user-friendly form
      • Customize Styles
      • Component Styling Possibilities
  • 🚀Connect your Data
    • Data source basics
    • Data sources in OpenFlower
      • APIs as Datasource
        • REST API
        • GraphQL
        • Google Sheets
      • SQL Databases
        • MySQL
        • MariaDB
        • PostgreSQL
        • Microsoft SQL Server
        • Oracle
      • NoSQL Databases
        • MongoDB
        • CouchDB
        • DynamoDB
      • InMemory Databases
        • Redis
      • File Storages
        • S3 File Storage
      • BigData & OLAP
        • Big Query
        • Snowflake
        • ClickHouse
        • Elasticsearch
      • Websocket Datasource
    • Query basics
      • Bind Query Data to Components
      • Query library
  • 🪄Workflows
    • n8n Integration
  • 💫Business Logic in Apps
    • Write JavaScript
      • JavaScript query
      • Temporary state
      • Transformers
      • Data responder
      • Built-in JS functions
  • 🙌Publish Apps
    • Share an App
    • Publish an App
    • Embedd an App
      • Embed Apps in React
      • Native embed SDK
        • Build the SDK from Source
  • 🔥OpenFlower Extension
    • Opensource Contribution
      • Develop UI components for Apps
      • Develop Data Source Plugins
    • Use third-party libraries in Apps
      • Day.js Date handling
      • Import your own JavaScript Library
    • Custom component
    • OpenFlower Open REST API
Powered by GitBook
On this page
  • Initialization
  • Component development environment
  • Plugin configurations
  • Export components
  • Publish plugins
  • Import plugins
  • Code demo
  1. OpenFlower Extension
  2. Opensource Contribution

Develop UI components for Apps

With OpenFlower plugins, you can develop customized components that are consistent with native components for your specific scenarios.

Initialization

Execute the following yarn start file:

# Project initiation
yarn create lowcoder-plugin my-plugin

# Go to the project root
cd my-plugin

# Start the development environment
yarn start

Component development environment

After executing yarn start, the browser is automatically opened and you enter the component development environment.

Plugin configurations

In OpenFlower field in package.json file, you need to define the component properties. For example, the following is the explanation of several fields:

  • comps defines UI components contained in the plugin. For each component, the key name of the object is the unique identity, and the value is metadata.

  • comps[someCompKey].name defines the component name shown in the Insert tab.

  • comps[someCompKey].icon defines the component icon shown on the canvas. Use a relative path to where package.json file is located.

  • comps[someCompKey].layoutInfo defines the component layout:

    • w: width of the component. Counted by the number of grid cells (range: 1 - 24).

    • h: height of the component. Counted by the number of grid cells (range: >= 1).

  "OpenFlower": {
    "description": "",
    "comps": {
      "hello_world": {
        "name": "Hello World",
        "icon": "./icons/hello_world.png",
        "layoutInfo": {
          "w": 12,
          "h": 5
        }
      },
      "counter": {
        "name": "Counter",
        "icon": "./icons/hello_world.png"
      }
    }
  }

Export components

To export all the components, use src/index.ts, for example:

import HelloWorldComp from "./HelloWorldComp";

export default {
  hello_world: HelloWorldComp,
};

The default exported object key needs to be consistent with the key configured in comps in package.json file.

Publish plugins

When you finish developing and testing the plugin, you can publish it into the npm registry. Login in to the npm registry locally, and then execute the following command:

yarn build --publish

If you do not specify the parameter --publish, the tar file will be saved in the root folder.

Import plugins

In the OpenFlower app, click Insert > Extensions > Add npm plugin in the right pane.

Input your npm package's URL or name, and then you can use your customized components.

my-plugin

# or

https://www.npmjs.com/package/my-plugin

Code demo

For code demo, refer to OpenFlower Github.

PreviousOpensource ContributionNextDevelop Data Source Plugins

Last updated 7 months ago

🔥