Form
Forms are used to collect, validate and submit data through your application.
Examples
import React from 'react';
import ReactDOM from 'react-dom';
import { Form, FormLegend, FormLabel, Input } from 'furl-components';
ReactDOM.render(
<div>
<Form>
<FormLegend>Signup form</FormLegend>
<FormLabel htmlFor='username'>Username</FormLabel>
<Input id='username' placeholder='Enter your username...' />
<FormLabel htmlFor='pwd'>Password</FormLabel>
<Input type='password' id='pwd' placeholder='Enter your password...' />
<FormLabel htmlFor='pwd-repeat'>Repeat Password</FormLabel>
<Input type='password' id='pwd-repeat' placeholder='Repeat your password...' />
<FormLabel htmlFor='email'>E-mail</FormLabel>
<Input type='email' id='email' placeholder='mail@server.com' />
</Form>
<Form
twoColumn
legend='Signup form'
data={[
{
name: 'username',
label: 'Username'
},
{
type: 'password',
name: 'password',
placeholder: '',
label: 'Password'
},
{
type: 'password',
name: 'repeat',
placeholder: '',
label: 'Repeat password'
},
{
type: 'email',
name: 'email',
label: 'E-mail',
placeholder: 'mail@server.com'
}
]}
/>
</div>,
document.getElementById('root')
);API
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| color | form color | string | 'plain' | ||
| size | form size | string | 'normal' | ||
| fill | form fill style | string | 'flat' | ||
| twoColumn | form two column layout | boolean | false' | ||
| legend | form legend | string | |||
| data | form data source | array(object) | |||
| action | form action | string | |||
| method | form method | string | |||
| name | form name | string | |||
| encType | form encoding type | string | |||
| openIn | form response target | string | 'self' | ||
| autocomplete | form autocomplete property | boolean | false | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| htmlFor | label bound element id | string | |||
Notes
- You can populate a form either via passing children to it or via the use of the
dataprop. Ifdatais provided, it will take precedence over passed children, therefore rendering only the content provided indata. dataonly accepts an array of objects, allowing you to pass a React component tree.colorcan be one of the following:'normal','light'or'dark'.sizecan be one of the following:'small','normal'or'large'.fillcan be one of the following:'flat'or'solid'.openIncan be one of the following:'self','blank'or'external'.
