If a newly created block is a complex data block, it may contain multiple dynamically added parts. The Configure actions initializer is mainly responsible for dynamically adding some buttons to implement various operations. For example, in the Details block, we can add Edit, Print, and other buttons through Configure actions.

This example will continue based on Adding Data Block Data Block to implement an effect similar to the Details block, configuring buttons through Configure actions.
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:
As mentioned earlier, this example will continue based on Adding Data Block Data Block, so we can copy the packages/plugins/@nocobase-sample/plugin-initializer-block-data/src/client directory to overwrite packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client.
Then modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/index.tsx:
Then modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/constants.ts:
We create packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/configureActionsInitializer.ts file:
We defined a new SchemaInitializer through the above code, and the sub-items are temporarily empty.
icon: Icon, more icons can be found at Ant Design Iconstitle: Button titleThen export it in packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/index.ts:
And modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/index.tsx to export configureActions:
Then modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/index.tsx file to import and register this initializer:
We modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/schema/index.ts file to add a new actions child node:
configure actions is generally used in combination with the ActionBar component.
We added an actions field to the child nodes of Info:
type: 'void': Type is void, indicating this is a containerx-component: 'ActionBar': Use ActionBar component to display buttonsx-initializer: configureActionsInitializer.name: Use the Schema Initializer we just createdx-component-props.layout: 'two-column': Left and right layout, specific examples can be found at ActionBar two-columnWe modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/component/Info.tsx file to modify the Info component:
children: The content of properties will be passed to the children of the InfoV2 component, so we just need to render children directly.
Custom request ActionWe continue to modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/configureActionsInitializer.ts file:
Because we directly reused the CustomRequestInitializer component for Custom request, more reusable Initializer Items can be found at TODO.

Custom Refresh ActionIn addition to reusing existing Initializer Items, we can also customize Actions. For detailed steps on customizing Actions, refer to Adding Simple Action and Adding Action with Modal.
Here we implement a Custom Refresh Action.
We create packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/constants.ts:
We create packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/schema.ts file:
We defined customRefreshActionSchema and dynamic property useCustomRefreshActionProps.
customRefreshActionSchema:
type: 'void': Type is void, indicating plain UI with no datax-component: 'Action': Use Action component to display buttontitle: 'Custom Refresh': Button titlex-use-component-props: 'useCustomRefreshActionProps': Use the properties returned by the useCustomRefreshActionProps Hooks. Since Schema will be saved to the server, it needs to be used in string format here.'x-toolbar': 'ActionSchemaToolbar': Generally used with the Action component. Unlike the default ToolBar, it hides the Initializer in the upper right corner of Action, keeping only Drag and Settings.useCustomRefreshActionProps: This is a React Hooks that needs to return the properties of the Action component.
DataBlockProvider, used to automatically get the data block's data
runAsync: An asynchronous request method used to refresh the data block's datatype: 'primary': Button type is primaryonClick: Click event.Then export it in packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/index.ts:
And modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/index.ts to export customRefresh:
We also need to register useCustomRefreshActionProps to the context. We modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/index.tsx file:
For the use of SchemaComponentOptions, refer to the SchemaComponentOptions documentation and Global Registration of Component and Scope.
We create packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/settings.ts
customRefreshActionSettings: Here we only simply defined a remove operation. For more information about Schema Settings definitions, refer to the Schema Settings documentation.
Modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/index.ts to export it:
Then register customRefreshActionSettings to the system. We modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/index.tsx file:
We modify the customRefreshActionSchema method in packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/schema.ts file to set x-settings to customRefreshActionSettings.name.
We continue to modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/items/customRefresh/initializer.ts file:
type: 'item': Type is item, indicating text that triggers onClick event when clickedname: 'custom refresh': Unique identifier used to distinguish different Schema Items and CRUD operationstitle: 'Custom Refresh': Button titleFor more information about Schema Item definitions, refer to the Schema Initializer Item documentation.
Then modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/index.ts to export it:
We modify packages/plugins/@nocobase-sample/plugin-initializer-configure-actions/src/client/initializer/configureActions/configureActionsInitializer.ts file to add customRefreshActionInitializerItem to items:
You can implement more Actions as needed.
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-configure-actions.tar.gz file, and then install it by uploading.