2.0.21 • Published 7 months ago
@ismail424/svelte-formly v2.0.21
Svelte Formly
by @kamalkech
Introduction
- ⚡️ Generate dynamic and reactive forms.
- 😍 Easy to extend with custom field type, custom validation.
Documentation
Quick Installation
npm install svelte-formly
Usage
<script lang="ts">
import { Formly, type IField } from 'svelte-formly';
const form_name = 'formly_usage';
const fields: IField[] = [
{
type: 'input', // required
name: 'firstname', // required
attributes: {
type: 'text',
id: 'firstname', // required
classes: ['form-control'],
placeholder: 'Tap your first name'
},
rules: ['required', 'min:3', 'max:10'],
messages: {
required: 'The firstname is required',
min: 'Your firstname is too short min=3',
max: 'Your firstname is too long max=10'
}
},
{
type: 'input', // required
name: 'password', // required
attributes: {
type: 'password',
id: 'password', // required
classes: ['form-control'],
placeholder: 'Tap your password',
autocomplete: 'off'
},
rules: ['required', 'min:6', 'max:10'],
messages: {
required: 'The password is required',
min: 'Your password is too short min=6',
max: 'Your password is too long max=10'
}
}
];
const onSubmit = ({ detail }: any) => {
console.log('values:', detail);
};
</script>
<Formly {fields} {form_name} on:submit={onSubmit} />
2.0.21
7 months ago
2.0.20
9 months ago
2.0.19
9 months ago
2.0.18
9 months ago
2.0.17
9 months ago
2.0.16
9 months ago
2.0.15
10 months ago
2.0.14
10 months ago
2.0.13
10 months ago
2.0.12
10 months ago
2.0.11
10 months ago
2.0.10
10 months ago
2.0.9
10 months ago
2.0.8
10 months ago
2.0.7
10 months ago
2.0.6
10 months ago
2.0.5
10 months ago
2.0.4
10 months ago
2.0.3
3 years ago
2.0.2
3 years ago