Was this page helpful?

Component library

Introduction

The Forma 36 Design System and React component library provides a comprehensive collection of UI components which can be used to quickly build UI Extensions and Contentful related applications.

Requirements

  • Forma 36 requires React >= 16.6.3

Getting Started

Starting from scratch

The easiest way to create a new extension with React and Forma 36 is to use create-contentful-extension CLI, similar to the well-known create-react-app. It generates an example extension for you and hides all configuration details, so you don’t need to install or configure tools like Webpack, Babel or Parcel. These tools are preconfigured and hidden so that you can focus on your own code.

Read Manage UI Extensions via the CLI to learn more.

Add to an existing UI Extension that uses Webpack or Parcel

  npm i react react-dom @contentful/app-sdk @contentful/forma-36-react-components
import { init } from "@contentful/app-sdk"
import React from "react"
import ReactDOM from "react-dom"
import { Button } from "@contentful/forma-36-react-components"
import "@contentful/forma-36-react-components/dist/styles.css"

class App extends React.Component {
  render() {
    return (
      <Button
        buttonType="primary"
        onClick={() => {
          console.log("You clicked on Forma36 button")
        }}
      >
        Click on me
      </Button>
    )
  }
}

init(() => {
  ReactDOM.render(<App />, document.getElementById("root"))
})

Examples built with Forma36 and create-contentful-extension

Next steps

Not what you’re looking for? Try our FAQ.