docs: update readme
This commit is contained in:
parent
659080d83e
commit
90e2ec6fb5
1 changed files with 20 additions and 1 deletions
21
README.md
21
README.md
|
@ -21,17 +21,36 @@ npm i astro-reactive-form
|
||||||
---
|
---
|
||||||
import Form, { FormGroup } from "astro-reactive-form";
|
import Form, { FormGroup } from "astro-reactive-form";
|
||||||
|
|
||||||
const form = new FormGroup([
|
|
||||||
|
// example of a form control
|
||||||
|
const radio: FormControl = {
|
||||||
|
name: 'is-good-looking',
|
||||||
|
type: 'radio',
|
||||||
|
label: 'Is Good Looking?',
|
||||||
|
value: 'checked',
|
||||||
|
labelPosition: 'right',
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = new FormGroup([ // this is just an array of FormControl
|
||||||
{
|
{
|
||||||
name: 'first-name',
|
name: 'first-name',
|
||||||
value: 'Ayo',
|
value: 'Ayo',
|
||||||
label: 'First Name',
|
label: 'First Name',
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'last-name',
|
name: 'last-name',
|
||||||
value: 'Ayco',
|
value: 'Ayco',
|
||||||
label: 'Last Name',
|
label: 'Last Name',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'is-awesome',
|
||||||
|
type: 'checkbox',
|
||||||
|
label: "Is Awesome?",
|
||||||
|
value: 'checked',
|
||||||
|
labelPosition: 'right',
|
||||||
|
},
|
||||||
|
radio // the form control we declared earlier
|
||||||
]);
|
]);
|
||||||
---
|
---
|
||||||
<Form formGroup={form} />
|
<Form formGroup={form} />
|
||||||
|
|
Loading…
Reference in a new issue