0.4.3 • Published 9 months ago
@formsignals/form-core v0.4.3
The core library for managing forms with Preact Signals.
Features
- TypeScript - Written in TypeScript with full type support for optimal DX.
- Reactivity - Reactivity without abstractions thanks to Preact Signals.
- Validation - Built-in validation support, including adapters for validation schema libraries.
- Transformations - Transform values for the specific needs of your input fields.
- Field Groups - Group fields together to manage parts of a form independently.
- Async Data - Easily manage async initialisation, validation and submission.
- Arrays + Dynamic Objects - Utilize arrays and dynamic objects within your forms.
Install
npm install @formsignals/form-core
If you have not installed signals, you will need to install it as well:
npm install @preact/signals-core
Quickstart
Create a new form instance:
const form = new FormLogic({
defaultValues: {
name: '',
email: '',
},
});
Then get a field instance from the form and configure it:
const nameField = form.getOrCreateField('name', {
validate: (value) => {
if (!value) {
return 'Name is required';
}
},
});
Now you can interact with the field:
nameField.handleChange('John Smith');
You can also access the underlying signal directly:
const nameLength = computed(() => nameField.value.length);
0.4.3
9 months ago
0.3.0
1 year ago
0.2.1
1 year ago
0.4.1
12 months ago
0.4.0
1 year ago
0.3.1
1 year ago
0.4.2
11 months ago
0.1.2
1 year ago
0.1.3
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago
0.0.10
1 year ago
0.0.13
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.3
1 year ago
0.0.4
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago