NocoBase has many Configure actions buttons for adding action buttons to the interface.

If the existing action buttons do not meet our requirements, we need to add sub-items to the existing Configure actions to create new action buttons.
This example will create a button that opens a modal when clicked. The content of the modal is an iframe embedding the block's documentation, and add this button to the Configure actions in Table, Details, and Form blocks.
The complete example code for this document can be found in plugin-samples.
Following the Write Your First Plugin documentation, if you don't have a project yet, you can create one first. If you already have one or have cloned the source code, you can skip this step.
Then initialize a plugin and add it to the system:
Then start the project:
After logging in, visit http://localhost:13000/admin/pm/list/local/ to see that the plugin has been installed and enabled.
Before implementing this example, we need to understand some basic knowledge:
First, we need to define the action name, which will be used in various places.
We create packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/constants.ts:
NocoBase's dynamic pages are all rendered through Schema, so we need to define a Schema, which will be used later to add to the interface. Before implementing this section, we need to understand some basic knowledge:
We create packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/schema/index.ts file with the following content:
The createDocumentActionModalSchema component accepts a blockComponent parameter and returns a Schema. This Schema is used to add a button to the interface. When clicked, it opens a modal, and the content of the modal is an iframe whose src is the block's documentation.
createDocumentActionModalSchema:
type: Type, here it is void, indicating a pure UI componentx-component: 'Action': Action component used to generate a buttontitle: 'Open Document': Button titleproperties: Child nodes
For more information about Schema, please refer to the UI Schema documentation.
There are 2 ways to verify Schema:
yarn doc plugins/@nocobase-sample/plugin-initializer-action-modal, and verify if it meets the requirements by writing documentation examples (TODO)We use temporary page verification as an example. We create a new page and add one or more examples according to property parameters to check if they meet the requirements.
Then we visit http://localhost:13000//admin/open-document-schema to see the temporary page we added.
For detailed explanation of SchemaComponent, please refer to the SchemaComponent documentation.
After verification, the test page needs to be deleted.
We create packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/initializer/index.ts file:
Because we need to generate different DocumentActionModal based on different blockComponent, we defined a createDocumentActionModalInitializerItem function to generate the corresponding Schema Initializer Item.
type: Type, here it is item, indicating a text with a click event that can insert a new Schema when clickedname: Unique identifier used to distinguish different Schema Items and CRUD operationsuseComponentProps: Returns an object containing title and onClick properties, title is the displayed text, onClick is the callback function after clickingSchemaInitializerContext context, which contains some operation methodsFor more information about Schema Item definitions, please refer to the Schema Initializer Item documentation.
Currently, after adding through createDocumentActionInitializerItem(), it cannot be deleted. We can use Schema Settings to set it.
We create packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/settings/index.ts file:
We modify the createDocumentActionModalSchema function in packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/schema/index.ts file to add documentActionModalSettings to x-settings.
There are many Configure actions buttons in the system, but their names are different. We need to add it to the Configure actions in Table, Details, and Form blocks according to our needs.
First, let's find the corresponding name:
TODO
Then we modify packages/plugins/@nocobase-sample/plugin-initializer-action-modal/src/client/index.tsx file:
After multi-language files are changed, you need to restart the service for them to take effect
We edit packages/plugins/@nocobase-sample/plugin-initializer-action-simple/src/locale/en-US.json with the following content:
We edit packages/plugins/@nocobase-sample/plugin-initializer-action-simple/src/locale/zh-CN.json with the following content:
If you need more multi-language support, you can continue to add them.
We can add multiple languages through http://localhost:13000/admin/settings/system-settings, and switch languages in the upper right corner.

According to the Build and Package Plugin documentation, we can package the plugin and upload it to the production environment.
If you cloned the source code, you need to execute a full build first to build the plugin's dependencies as well.
If you used create-nocobase-app to create the project, you can directly execute:
This way you can see the storage/tar/@nocobase-sample/plugin-initializer-action-modal.tar.gz file, and then install it by uploading.