2.2.1 • Published 15 days ago

@open-formulieren/sdk v2.2.1

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
15 days ago

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. Note that the SDK documentation is currently lacking. We're planning to publish Storybook documentation soon.

Audience

The target audience for this library is developers who want to compose their own version of the SDK without forking the repository.

Open Forms is developed as a white-label application, including the SDK. While the UI components are fairly generic, there are more organization/theme-specific layouts possible, requiring significant markup changes.

Rather than exposing and maintaining complex options for UI-component customization, we decided to publish the SDK as a library so that (experienced) developers can replace components as they need.

Usage

The package exports two ways to use the library:

  1. Importing and composing the invididual modules (ESM)
  2. Importing the library as a whole

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 individual modules

The underlying React components are published and can serve as a basis for your own components, or even completely replace them (TODO - this is on the roadmap!).

E.g. to re-use the card component:

import Card from '@openformulieren/sdk/components/Card';

const MyCard = props => <Card titleComponent="h2" {...props} />;

export default MyCard;

NOTE: the published components are semi-private API. We cannot provide guarantees that it will be 100% backwards-compatible. If we know breaking changes are made, we will bump the major version number, but you should probably do extensive testing even with minor versions.

Exposed API

The package.json describes the module exports, at the time of writing these are:

  • @openformulieren/sdk/components/*
  • @openformulieren/sdk/hooks/*
  • @openformulieren/sdk/types/*
  • @openformulieren/sdk/map/*
  • @openformulieren/sdk/sdk
  • @openformulieren/sdk/utils

These will be documented with Storybook at some point.

Using the library

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

import OpenForm, {
  ANALYTICS_PROVIDERS,
  Formio,
  OFLibrary,
  OpenFormsModule,
  Templates,
  setCSRFToken,
} from '@open-formulieren/sdk';
// JS API
import '@open-formulieren/sdk/styles.css';

// import the (default) stylesheet

const form = new OpenForm(targetNode, options);
form.init();
2.2.1

15 days ago

2.2.0

1 month ago

2.2.0-beta.0

1 month ago

2.1.5

1 month ago

2.0.4

2 months ago

1.5.8

2 months ago

2.1.4

2 months ago

2.2.0-alpha.0

2 months ago

2.0.3

3 months ago

1.5.7

3 months ago

2.1.3

3 months ago

1.4.8

3 months ago

2.1.2

3 months ago

2.1.1

3 months ago

2.1.0

3 months ago

2.1.0-beta.1

3 months ago

2.1.0-beta.0

3 months ago

2.0.2

4 months ago

2.1.0-alpha.0

5 months ago

1.3.9

5 months ago

1.5.6

5 months ago

1.4.7

5 months ago

2.0.1

5 months ago

1.5.5-odru.0

5 months ago

1.4.6

6 months ago

1.4.5

6 months ago

1.4.4

7 months ago

1.4.3

7 months ago

1.4.2

8 months ago

1.4.1

9 months ago

2.0.0

6 months ago

2.0.0-testing.0

6 months ago

2.0.0-testing.1

6 months ago

1.5.0-hodm.1

9 months ago

1.3.8

6 months ago

1.2.10

9 months ago

1.2.11

7 months ago

1.5.5

6 months ago

1.3.7

6 months ago

1.5.4

6 months ago

1.3.6

7 months ago

1.5.3

7 months ago

1.3.5

9 months ago

1.5.2

7 months ago

1.5.1

8 months ago

1.6.0-alpha.0

7 months ago

1.5.0

8 months ago

2.0.0-post.0

6 months ago

1.5.0-alpha.0

9 months ago

1.3.4

11 months ago

1.4.0

11 months ago

1.2.9

11 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.3.1-rc.0

1 year ago

1.2.6

1 year ago

1.3.0-beta.0

1 year ago

1.2.5

1 year ago

1.3.0-alpha.1

1 year ago

1.3.0-alpha.0

1 year ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.2.0-alpha.1

2 years ago

1.2.0-alpha.0

2 years ago