Link Search Menu Expand Document

Getting started

Installation

Install per Yarn from npmjs.com.

yarn add liform-react-final

Usage

Pass the Liform props object created by Pitch Liform (or by other means) to the Liform component.

With the default theme
import Liform, { DefaultTheme } from 'liform-react-final'

// once per property on the default export ...
Liform.theme = DefaultTheme
<Liform {...liformProps}/>
With another theme
import { Liform } from 'liform-react-final'
import theme from 'liform-material'

// ... or as jsx attribute
<Liform {...liformProps} theme={theme}/>
Render into DOM
import ReactDOM from 'react-dom';

ReactDom.render(
    <Liform {...liformProps}/>,
    document.getElementById('form-container')
)

This will render the form in #form-container.

Once the user clicks the submit button and the values pass the validation the form value is sent to the server via POST request.

The server can report failure or success per HTTP status 2xx or 4xx.

For application/json responses with a new Liform props object the form will be updated.

For text/html responses a new document will be written.

If there is a location header e.g. for a 201 Created response, the user will be redirected.