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

1.4.8 • 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

10,370

Version

1.4.8

License

MIT

Unpacked Size

61 kB

Total Files

39

Last publish

Collaborators

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