Methods
(inner) expandShorthand(field) → {Object}
Expand field definition from shorthand: simple string, or array
Parameters:
| Name | Type | Description |
|---|---|---|
field |
string | array | Object | shorthand field definition |
Returns:
field definition as an argument for Field()
- Type
- Object
(inner) Field(f) → {Object}
High level user input field inc optional label, multiple options etc
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
Object | field proerties
Properties
|
Returns:
vnode with optional label
- Type
- Object
Examples
Field({placeholder: "email"})
Field({placeholder: "email", style:{color: red}})
<Field placeholder="email"></Field>
(inner) Form(f) → {Object}
Creates form element
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
Object | Form properties
Properties
|
Returns:
vnode
- Type
- Object
Example
<Form onSubmit={({email}) => console.log({email})}>
<Field placeholder="email"> </Field>
<Form>
(inner) parseFormInputs(elements) → {Object}
Parse form values, eg for onSubmit. Exposed for testing purposes.
Parameters:
| Name | Type | Description |
|---|---|---|
elements |
Object | event.target |
Returns:
event target values in a convenient form
- Type
- Object
Example
example return value:
{
"inputs": {
"text_input_with_value": "quick brown fox",
"textarea": "quick brown fox jumped.\nYes he did.\n",
"checkboxes": [
"Apple"
],
"radios": "Pear",
"select_fruit": [
"apple",
"Pear"
]
}
}