Skip to main content

Custom Component Libraries

IconPaid feature
BETA

Custom Component Libraries are currently in beta and not recommended for production use.

Custom Component Libraries are sets of React components that are published to a ToolJet workspace with the ToolJet CLI and used in the App Builder like built-in components. Every app builder in the workspace can add them to the canvas. Each application pins a version of the library, and the components are configured in the component properties panel.

A library is what you publish and version. The components inside it are what app builders drag onto the canvas. One publish ships every component in the library as a single version.

Workflow​

A custom component goes through three steps before it is used in an application.

Publish Only Trusted Code

A custom component's code runs inside the app page, so it can read what's on the page and act as the person using the app. Only admins and builders can publish a library.

How It Works​

Four parts of ToolJet are involved, and you use them in this order:

Part
What It Is
Who Uses It
@tooljet/cliAn npm CLI that scaffolds, builds, previews and publishes a library.Developer
@tooljet/custom-component-sdkA TypeScript package with the ToolJet hooks a component uses to declare its properties, events and actions.Developer, in component code
Workspace settings → Custom component librariesLists every library published to the workspace and lets an admin delete one.Workspace admin
The library picker in the App BuilderWhere a published library is selected under Custom libraries, and its components are dropped on the canvas and configured.App builder

The end-to-end flow is shown below. Steps with a $ are CLI commands you run in a terminal. The other steps happen in ToolJet or in your code editor.

Before You Start​

Roles and Permissions​

Action
Required Role
Create a personal access tokenAdmin or Builder
Create, publish and dev-preview a library (with the CLI)Admin or Builder, with a token
Browse and use components in the App BuilderAny member who can edit apps
Delete a libraryAdmin only

Prerequisites​

To build a library, you need:

  • Node.js 18 or later and npm.
  • The ToolJet CLI. See Sign In to the CLI for the install command.
  • React 18. The scaffold pins ^18.2.0. ToolJet provides React to the component at runtime, so your components must not bundle their own copy.
info

A personal access token belongs to one workspace. To publish the same library to a second workspace, create a token in that workspace and run the CLI again with it.

Next Steps​

  1. Set up the CLI and create a library
  2. Build components with the SDK
  3. Preview and publish a library
  4. Use custom components in the App Builder
  5. Manage libraries in the workspace

For every command, flag and limit in one place, see the CLI Reference.