2.3.2 • Public • Published

    Staffbase Logo

    Staffbase Create-Widget


    The "Create Widget" repository is an utility to kick start the development of a custom element, used in the employee application. It generates the file and folder structure, a first small example widget and the toolbelt to run the development cycle and build the final script.

    The widgets are based on the web component standard and leverage the lifecycle methods of it. Read more about web components in the documentation.

    File structure

    The root folder contains the configuration files and package manager description. For Webpack the config differentiate between development and production environments for more clarity.

    ├── README.md
    ├── favicon.png
    ├── index.html
    ├── package.json
    ├── src
    │   ├── bootstrap.ts
    │   ├── config.tsx
    │   ├── configuration-schema.ts
    │   ├── dummy-widget.tsx
    │   └── index.tsx
    ├── tsconfig.json
    ├── webpack.common.js
    ├── webpack.dev.js
    └── webpack.prod.js

    Source files


    A mocked implementation of the registration methods used in the real application. It is needed to preview the widget in development.


    The configuration form which is rendered from the configuration schema in the widget. It is also used in the preview to alter the component.


    A simple schema to define custom settings for the widget. For more information, please refer to the documentation of RJFS.


    The naming of this file should reflect the chosen widget name. This file contains the logic of the widget. It is rendered within the render method of the index.tsx file.


    Bootstrap the widget here to be used inside the target platform. Also the block definition is set here.


    npx @staffbase/create-widget

    Read more about custom-element naming conventions here.



    Running Locally

    To run the generator from a local copy of the source code, first install dependencies:

    npm install

    then build the generator:

    npm run build

    and finally, start the generator using:

    node bin/index.js

    The generated widget code will reside in the current directory.

    Known Issues:

    • The development preview of the widget and the preview of the configuration are not connected. Submitting the form doesn't update the widget on the left hand side.
    • not compatible with npm 7


    npm i @staffbase/create-widget

    DownloadsWeekly Downloads






    Unpacked Size

    4.21 MB

    Total Files


    Last publish


    • staffbase.com
    • scthi
    • holgerstein