npm.io
3.5.4 • Published 1 month ago

@open-formulieren/sdk

Licence
EUPL-1.2
Version
3.5.4
Deps
0
Vulns
0
Weekly
0
Stars
3

Open Forms SDK

NPM package Coverage Storybook code style: prettier

The Open Forms SDK is the frontend to the Open Forms backend. We publish it as both an NPM library of components and pre-built Docker image.

The documentation is available online. The SDK documentation is available in our Storybook.

Audience

The target audience for this library is developers who want to embed the SDK into their own frontend bundles, and users that may want to use our SDK implementation in their storybook for documentation and visual regression testing.

Usage

The package exports two ways to use the library:

  1. Importing and composing the invididual modules (ESM, recommended)
  2. Importing the library as a whole (ESM or UMD bundle)

The former approach allows more fine-grained control and should exclude code/dependencies that aren't used and result in smaller builds, while the latter gives you the public API as it would be available in the browser.

Given the target audience, we expect developers to use option 1.

Using the library

If you decide that using the SDK itself is sufficient, then your usage comes down to:

// JS API
import {ANALYTICS_PROVIDERS, OpenForm, VERSION} from '@open-formulieren/sdk';
// import the (default) stylesheet
import '@open-formulieren/sdk/styles.css';

const form = new OpenForm(targetNode, options);
form.init();
Embedding in Storybook

See our dedicated external Storybook integration docs.