[READ-ONLY] Mirror of https://github.com/hokulea/pahu. Agnostic headless form with adapters for frameworks
README.md

@hokulea/ember-pahu #

Maintainability Code Coverage

🪘 The pahu is a traditional musical instrument found in Polynesia: Hawaii, Tahiti, Cook Islands, Samoa, and Tokelau.

@hokulea/ember-pahu is the Ember adapter for Hokulea headless forms.

Features #

  • HTML first. Use native form features through a pleasent API
  • Validation & Revalidation
  • Validators: Native, Custom, Standard Schema (zod, valibot, ark type, ...)
  • Nested & initial data
  • Linked Fields
  • Typescript support
  • Component free

Installation #

pnpm add @hokulea/ember-pahu ember-modifier ember-resources

Usage #

import { createForm } from '@hokulea/pahu/ember';

const submitHandler: SubmitHandler = (data) => console.log('Submit Handler', data);
const validationHandler: ValidatedHandler = (event, data) =>
  console.log('Validation Handler on:', event, data);

<template>
  {{#let (createForm submit=submitHandler validated=validationHandler) as |f|}}
    <form novalidate {{f.registerElement}}>
      <label>
        Email
        <input type="email" name="email" />
      </label>

      <label>
        Age
        <input type="number" name="age" required />
      </label>

      <fieldset>
        <legend>Favorite Pokemon</legend>
        <label><input type="radio" name="pokemon" value="Bulbasaur" required /> Bulbasaur</label>
        <label><input type="radio" name="pokemon" value="Squirtle" /> Squirtle</label>
        <label><input type="radio" name="pokemon" value="Charmander" /> Charmander</label>
      </fieldset>

      <button type="submit">Submit</button>
    </form>
  {{/let}}
</template>

Examples #