@contentful/field-editor-shared
TypeScript icon, indicating that this package has built-in type declarations

2.7.0 • Public • Published

@contentful/field-editor-shared

This package contains shared code (components, utilities, test utilities) that is used by all other field editor packages.

The most useful component for developing any kind of apps is FieldConnector that helps you to subscribe to field changes in a convenient way.

Checkout a simple implementation of an app for Boolean field:

import { FieldConnector } from '@contentful/field-editor-shared';

<FieldConnector<boolean> field={sdk.field}>
    {({ disabled, value, setValue }) => {
      return (
        <div>
          <div>{value ? 'I am true' : 'I am false'}</div>
          <button onClick={() => {
            setValue(!value)
          }}>
            toggle
          </button>
        </div>
      )
    }}
</FieldConnector>

Readme

Keywords

none

Package Sidebar

Install

npm i @contentful/field-editor-shared

Weekly Downloads

19,908

Version

2.7.0

License

MIT

Unpacked Size

225 kB

Total Files

105

Last publish

Collaborators

  • it-internal
  • whydah-gally
  • contentful-ecosystem
  • michaelpearce