@vielzeug/forge
v26.10.18
Published
Typed form state, validation, submission
Readme
@vielzeug/forge
Typed form state, validation, submission
Installation
pnpm add @vielzeug/forge
npm install @vielzeug/forge
yarn add @vielzeug/forgeQuick Start
import { createForm } from '@vielzeug/forge';
const form = createForm({
initialValues: { profile: { email: '', name: '' } },
validate: (value) =>
value.profile.email.includes('@')
? undefined
: [{ path: ['profile', 'email'], message: 'Enter a valid email' }],
});
const email = form.field('profile').field('email');
email.set('[email protected]');
const result = await form.submit((value) => saveProfile(value));Documentation
License
MIT © Helmuth Saatkamp: part of the Vielzeug monorepo.
