JSPM

  • Created
  • Published
  • Downloads 10469
  • Score
    100M100P100Q10762F
  • License MIT

Package Exports

  • @tinacms/core

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tinacms/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@tinacms/core

A CMS Toolkit

Installation

Install the package

npm install --save @tinacms/core

or

yarn add @tinacms/core

Getting Started

@tinacms/core is the core for building content management systems.

import { CMS } from '@tinacms/core'

let cms = new CMS()

Add fields plugins:

cms.forms.addFieldPlugin({
  name: "text",
  Component({ input, field }) {
    return (
      <label name={input.name}>
        {field.name}
        <input {...} />
      </label>
    )
  }
})

Field Plugin Props

- input: [See Input Props here](https://github.com/final-form/react-final-form#fieldrenderprops)
- meta: [See Meta Props here](https://github.com/final-form/react-final-form#fieldrenderprops)
- field:
  - name: string;
  - component: React.FC<any> | string;

Register a new form:

let form = cms.forms.createForm({
  name: 'hello-world',
  initialValues: {
    title: 'Hello World',
    description: 'A fun time can be head with programming.',
  },
  fields: [
    { name: 'title', component: 'text' },
    { name: 'description', component: 'text' },
  ],
})

API

The following can be imported from @tinacms/cms

CMS

The base CMS class.

forms: FormManager

TODO

Subscribable

TODO

Types

Form

FormManager

create<S>(options: FormOptions<S>): Form<S>

findForm(name: string): Form

removeForm(): void

all(): Form[]

addFieldPlugin(): void

getFieldPlugin(name: string): FieldPlugin | null

FormOptions<S>

FieldPlugin