How to use the tinacms.useLocalForm function in tinacms

To help you get started, we’ve selected a few tinacms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / web / src / brandkit / Tina.tsx View on Github external
export default function ExamplePage(props) {
  // grab the instance of the CMS to access the registered git API
  const cms = useCMS()

  // add a form to the CMS; store form data in `post`
  const [post, form] = useLocalForm({
    id: props.fileRelativePath,
    label: 'Edit Post', // needs to be unique
    // starting values for the post object
    initialValues: { title: props.title, headline: props.headline, markdown: props.markdown },
    // field definition
    fields: [
      { name: 'title', label: 'Title', component: 'text' },
      { name: 'headline', label: 'Headline', component: 'textarea' },
      {
        name: 'markdown',
        component: 'markdown',
        label: 'Post Body',
        description: 'Edit the body of the post here',
      },
    ], // save & commit the file when the "save" button is pressed
    onSubmit(data) {

tinacms

[![GitHub license](https://img.shields.io/github/license/tinacms/tinacms?color=blue)](https://github.com/tinacms/tinacms/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/tinacms.svg?style=flat)](https://www.npmjs.com/package/tinacms) [![Bui

Apache-2.0
Latest version published 23 days ago

Package Health Score

89 / 100
Full package analysis