Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

hypermedia-app/alcaeus-forms

Repository files navigation

@hydrofoil/alcaeus-form

Automatically render forms for Hydra-driven operations

Build Status BrowserStack Status codecov

Installation

npm i --save @hydrofoil/alcaeus-forms

Usage

Here's an example showing how form is used with lit-html

import { Hydra } from 'alcaeus'
import { html } from 'lit-html'
import '@hydrofoil/alcaeus-forms/alcaeus-form'

const resource = (await Hydra.loadResource('http://hydra-movies.herokuapp.com/')).root
const collection = resource.getCollections()[0]
resource.operations.find(op => op.method === 'POST')

const form = html`<alcaeus-form .operation="${operation}"></alcaeus-form>`