Input
Inputs allow users to submit data to your application.
Examples
Drag and drop or click to upload files
import React from 'react';
import ReactDOM from 'react-dom';
import { Input } from 'furl-components';
ReactDOM.render(
<div>
<Input type='text' label='Text' placeholder='Text' icon='user' size='small' shape='rounded' />
<Input type='textarea' label='Multiline text' placeholder='Multiline text' rows={2} />
<Input type='email' label='E-mail' placeholder='mail@server.com' icon='mail' />
<Input type='url' label='URL' placeholder='https://google.com' icon='at-sign' />
<Input type='password' label='Password (with revealer)' icon='key' withRevealer />
<Input type='number' label='Number' placeholder='0' min={1} max={40} step={3} />
<Input type='select' label='Select' icon='cloud' data={[
'Cloudy',
{ title: 'Cloudier', selected: true },
'Cloudiest'
]} />
<Input type='select' label='Multiple select' multiple data={[
'Cloudy', 'Cloudier', 'Cloudiest'
]} />
<Input type='combobox' label='Combo box' icon='sun' data={[
'Sunny', 'Sunnier', 'Sunniest'
]} />
<Input type='creditcard' label='Credit card' placeholder='0000-0000-0000-0000' icon='credit-card' />
<Input type='phone' label='Phone' placeholder='+30 (123) 456-7890' icon='phone' />
<Input type='currency' label='Currency' placeholder='$' icon='dollar-sign' />
<Input type='time' label='Time' placeholder='HH:MM' icon='clock' displaySeconds={false}/>
<Input type='date' label='Date' placeholder='dd/mm/yyyy' icon='calendar' />
<Input type='color' label='Color' placeholder='#ffffff' icon='sliders' />
<Input type='file' label='Upload' placeholder='Drag and drop or click to upload files' />
<Input type='rating' label='Rating' />
<Input type='rating' label='Rating (custom)' iconName='heart' iconFillColor='var(--danger-red-500)' iconStyle='fill' />
<Input type='slider' label='Slider' min={10} max={25} />
<Input type='slider' label='Range slider' range min={10} max={25} />
<Input type='checkbox' label='Checkbox' color='primary' >I accept the terms of agreement.</Input>
<Input type='radiogroup' label='Radio group' name='radios' data={[
'Choice A',
{ color: 'primary', value: 'Choice B'},
{ color: 'secondary', title: 'Choice C'}
]} />
</div>,
document.getElementById('root')
);API
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| type | input type | string | 'text' | ||
| defaultValue | input default value | string/number | |||
| label | input label | string | |||
| icon | icon name to be used | string | |||
| size | input size | string | 'normal' | ||
| shape | input shape | string | 'normal' | ||
| name | input name within the form | string | |||
| placeholder | input placeholder | string | |||
| disabled | input disabled state | boolean | false | ||
| required | input required state | boolean | false | ||
| readOnly | input readonly state | boolean | false | ||
| onChange | input onchange event | function | |||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| rows | textarea row count | int | 5 | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| pattern | email validation pattern | regexp | '.+@.+\..+' | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| pattern | url validation pattern | regexp | 'https?://.+' | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| withRevealer | display password revealer | boolean | false | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| min | input minimum value | number | |||
| max | input maximum value | number | |||
| step | input step | number | 1 | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| currencySymbol | currency symbol | string | '$' | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| displayHours | display hours in input | boolean | true | ||
| displaySeconds | display seconds in input | boolean | true | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| monthBeforeDay | month before day format | boolean | false | ||
| separator | date segment separator | string | '/' | ||
| minYear | date minimum year | int | 1 | ||
| maxYear | date maximum year | int | 9999 | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| iconName | rating icon name | string | 'star' | ||
| iconStyle | rating icon style | string | 'outline' | ||
| iconFillColor | rating icon fill color | string | 'var(--warning-yellow-500)' | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| min | input minimum value | number | 0 | ||
| max | input maximum value | number | 100 | ||
| range | slider range type | boolean | false | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| multiple | input accepts multiple files | boolean | false | ||
| onFilesChanged | input onchange event (equivalent) | function | |||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| checked | checkbox checked state | boolean | |||
| color | checkbox color | string | 'plain' | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| data | radio group data source | array(string/object) | |||
| color | radio group color | string | |||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| data | select data source | array(string/object) | |||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| data | combo box data source | array(string/object) | |||
Notes
typecan be one of the following:'text','textarea','email','url','password','number','creditcard','phone','currency','time','date','rating','slider','color','file','checkbox','radiogroup','select'or'combobox'.- If
labelis specified, the component will render a<label>right before the<input>or HTML structure of the component. iconaccepts any valid icon name. You can find a full list of all the available values here.- If
iconis provided, it will render an icon on the left side of the input component. The following input types do not utilize the value oficon:'number','file','rating','slider','checkbox'and'radiogroup'. sizecan be one of the following:'small','normal'or'large'.shapecan be either'normal'or'rounded'.defaultValueand its type depends on the specifictype. Most types use an empty value as their default.'select','combobox','file'and'radiogroup'are not affected by the value ofdefaultValue.withRevealerwill render a small button on the right side of the'password'input, which will allow users to toggle password visibility on or off.- A
'rating'input’siconNameaccepts any valid icon name. You can find a full list of all the available values here. iconStylecan either be'outline'or'fill'.iconFillColoraccepts any valid CSS value, including CSS variables.- If
rangeistruefor a'slider'input, it will render a component that accepts two values, instead of one. - If
multipleistruefor any input type that supports it, the input will accept multiple values. - A
'file'input does not support theonChangeproperty. Instead it uses theonFilesChangedprop, whose supplied function will be fired with one argument, which is the name(s) of the file(s) selected. colorcan be any of the predefined color palettes ('plain','primary','secondary','success','warning'or'danger').- If
coloris specified for a'radiogroup'input, it wil override thecolorprop of its children. - The
dataprop of a'radiogroup'can be either an array of string values or objects or a mix of the two. Objects in thedataarray must have atitleand/orvalueand optionally acolor,nameand/or thecheckedprops, similary to the'checkbox'input type. - The
dataprop of a'select'or a'combobox'can be either an array of string values or objects or a mix of the two. Objects in thedataarray must have atitleand/orvalueand theselectedprop.
