Input / Form Elements React Components
Form elements allow you to create flexible and beautiful Form layout. Form elements are just well known List View ( and List Item React components) but with few additional components.
Check out Framework7’s for their appearance.
There are following components included:
- /
F7ListInput
- list item input element Input
/F7Input
- input element
Event | Arguments | Description |
---|---|---|
<ListInput>, <Input> events | ||
focus | (event) | Fired when user focused to input. |
blur | (event) | Fired when user lost focus from input. |
input | (event) | Fired immediately when input value changed. Note: Input event triggers after beforeinput, keypress, keyup, keydown events. |
change | (event) | Fired on blur if value changed. |
inputClear | (event) | Fired when input clear button clicked |
textareaResize | (event) | Fired if resizable textarea resized. event.detail will contain object with the initialHeight , currentHeight and scrollHeight properties |
inputEmpty | (event) | Fired when input value becomes empty |
inputNotempty | (event) | Fired when input value becomes not empty |
calendarChange | (value) | Fired when type=”datepicker” Calendar value changed. As an argument it receives array with selected dates. |
colorPickerChange | (value) | Fired when type=”colorpicker” Color Picker value changed. As an argument it receives object with Color Picker value. |
textEditorChange | (value) | Fired when type=”texteditor” Text Editor value changed. As an argument it receives Texteditor value (HTML string). |
<ListInput>
has additional slots for custom elements:
default
- in case oftype="select"
ortype="textarea"
- element will be placed inside ofselect
ortextarea
tags.info
- element will be inserted into container with info messageerror-message
- element will be inserted into container with error messagelabel
- element will be inserted into container with input’s labelinput
- element will be inserted instead of input element (input
prop must be also set tofalse
)root-start
- element will be inserted in the beginning of<li>
elementroot
/root-end
- element will be inserted in the end of<li>
elementcontent-start
- element will be inserted in the beginning of<div class="item-content">
elementcontent
/content-end
- element will be inserted in the end of<div class="item-content">
elementinner-start
- element will be inserted in the beginning of<div class="item-inner">
elementinner
/inner-end
- element will be inserted in the end of<div class="item-inner">
elementmedia
- element will be inserted inside of<div class="item-media">
element
Full Layout / Inline Labels
<List inlineLabels noHairlinesMd>
<ListInput
label="Name"
type="text"
placeholder="Your name"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Password"
type="password"
placeholder="Your password"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="E-mail"
type="email"
placeholder="Your e-mail"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="URL"
type="url"
placeholder="URL"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Phone"
type="tel"
placeholder="Your phone number"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Gender"
type="select"
defaultValue="Male"
placeholder="Please choose..."
>
<Icon icon="demo-list-icon" slot="media"/>
<option value="Male">Male</option>
<option value="Female">Female</option>
</ListInput>
<ListInput
label="Birthday"
type="date"
defaultValue="2014-04-30"
placeholder="Please choose..."
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Date time"
type="datetime-local"
placeholder="Please choose..."
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Range"
input={false}
>
<Icon icon="demo-list-icon" slot="media"/>
<Range slot="input" value={50} min={0} max={100} step={1}/>
</ListInput>
<ListInput
label="Textarea"
type="textarea"
placeholder="Bio"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Resizable"
type="textarea"
resizable
placeholder="Bio"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
</List>
Full Layout / Stacked Labels
<List noHairlinesMd>
<ListInput
label="Name"
type="text"
placeholder="Your name"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Password"
type="password"
placeholder="Your password"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="E-mail"
type="email"
placeholder="Your e-mail"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="URL"
type="url"
placeholder="URL"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Phone"
type="tel"
placeholder="Your phone number"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Gender"
type="select"
defaultValue="Male"
>
<Icon icon="demo-list-icon" slot="media"/>
<option value="Male">Male</option>
<option value="Female">Female</option>
</ListInput>
<ListInput
label="Birthday"
type="date"
defaultValue="2014-04-30"
placeholder="Please choose..."
>
</ListInput>
<ListInput
label="Date time"
type="datetime-local"
placeholder="Please choose..."
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Range"
input={false}
>
<Icon icon="demo-list-icon" slot="media"/>
<Range slot="input" value={50} min={0} max={100} step={1}/>
</ListInput>
<ListInput
label="Textarea"
type="textarea"
placeholder="Bio"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Resizable"
type="textarea"
resizable
placeholder="Bio"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
</List>
Date Pickers
Color Pickers
<List noHairlinesMd>
<ListInput
type="colorpicker"
label="Color Wheel"
placeholder="Color"
readonly
value={{ hex: '#00ff00' }}
/>
<ListInput
type="colorpicker"
label="Saturation-Brightness Spectrum"
placeholder="Color"
readonly
value={{ hex: '#ff0000' }}
colorPickerParams={{
modules: ['sb-spectrum', 'hue-slider'],
}}
/>
<ListInput
type="colorpicker"
label="RGB Sliders"
placeholder="Color"
readonly
value={{ hex: '#0000ff' }}
colorPickerParams={{
modules: ['rgb-sliders'],
sliderValue: true,
sliderLabel: true,
}}
/>
<ListInput
type="colorpicker"
label="RGBA Sliders"
placeholder="Color"
readonly
value={{ hex: '#ff00ff' }}
colorPickerParams={{
modules: ['rgb-sliders', 'alpha-slider'],
sliderValue: true,
sliderLabel: true,
formatValue(value) {
return `rgba(${value.rgba.join(', ')})`;
},
}}
/>
<ListInput
type="colorpicker"
label="HSB Sliders"
placeholder="Color"
readonly
value={{ hex: '#00ff00' }}
colorPickerParams={{
modules: ['hsb-sliders'],
sliderValue: true,
sliderLabel: true,
formatValue(value) {
return `hsb(${value.hsb[0]}, ${value.hsb[1] * 1000 / 10}%, ${value.hsb[2] * 1000 / 10}%)`
},
}}
/>
<ListInput
type="colorpicker"
label="RGB Bars"
placeholder="Color"
readonly
value={{ hex: '#0000ff' }}
colorPickerParams={{
modules: ['rgb-bars'],
openIn: 'auto',
barValue: true,
barLabel: true,
formatValue(value) {
return `rgb(${value.rgb.join(', ')})`;
},
}}
/>
<ListInput
type="colorpicker"
label="RGB Sliders + Colors"
placeholder="Color"
readonly
value={{ hex: '#ffff00' }}
colorPickerParams={{
modules: ['initial-current-colors', 'rgb-sliders'],
sliderValue: true,
sliderLabel: true,
formatValue(value) {
return `rgb(${value.rgb.join(', ')})`;
},
}}
/>
<ListInput
type="colorpicker"
label="Palette"
placeholder="Color"
readonly
value={{ hex: '#FFEBEE' }}
colorPickerParams={{
modules: ['palette'],
openIn: 'auto',
openInPhone: 'sheet',
palette: [
['#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C'],
['#F3E5F5', '#E1BEE7', '#CE93D8', '#BA68C8', '#AB47BC', '#9C27B0', '#8E24AA', '#7B1FA2', '#6A1B9A', '#4A148C'],
['#E8EAF6', '#C5CAE9', '#9FA8DA', '#7986CB', '#5C6BC0', '#3F51B5', '#3949AB', '#303F9F', '#283593', '#1A237E'],
['#E1F5FE', '#B3E5FC', '#81D4FA', '#4FC3F7', '#29B6F6', '#03A9F4', '#039BE5', '#0288D1', '#0277BD', '#01579B'],
['#E0F2F1', '#B2DFDB', '#80CBC4', '#4DB6AC', '#26A69A', '#009688', '#00897B', '#00796B', '#00695C', '#004D40'],
['#F1F8E9', '#DCEDC8', '#C5E1A5', '#AED581', '#9CCC65', '#8BC34A', '#7CB342', '#689F38', '#558B2F', '#33691E'],
['#FFFDE7', '#FFF9C4', '#FFF59D', '#FFF176', '#FFEE58', '#FFEB3B', '#FDD835', '#FBC02D', '#F9A825', '#F57F17'],
['#FFF3E0', '#FFE0B2', '#FFCC80', '#FFB74D', '#FFA726', '#FF9800', '#FB8C00', '#F57C00', '#EF6C00', '#E65100'],
],
formatValue(value) {
return value.hex;
},
}}
/>
<ListInput
type="colorpicker"
label="Pro Mode"
placeholder="Color"
readonly
value={{ hex: '#00ffff' }}
colorPickerParams={{
modules: ['initial-current-colors', 'sb-spectrum', 'hsb-sliders', 'rgb-sliders', 'alpha-slider', 'hex', 'palette'],
openIn: 'auto',
sliderValue: true,
sliderValueEditable: true,
sliderLabel: true,
hexLabel: true,
hexValueEditable: true,
groupedModules: true,
palette: [
['#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C'],
['#F3E5F5', '#E1BEE7', '#CE93D8', '#BA68C8', '#AB47BC', '#9C27B0', '#8E24AA', '#7B1FA2', '#6A1B9A', '#4A148C'],
['#E8EAF6', '#C5CAE9', '#9FA8DA', '#7986CB', '#5C6BC0', '#3F51B5', '#3949AB', '#303F9F', '#283593', '#1A237E'],
['#E1F5FE', '#B3E5FC', '#81D4FA', '#4FC3F7', '#29B6F6', '#03A9F4', '#039BE5', '#0288D1', '#0277BD', '#01579B'],
['#E0F2F1', '#B2DFDB', '#80CBC4', '#4DB6AC', '#26A69A', '#009688', '#00897B', '#00796B', '#00695C', '#004D40'],
['#F1F8E9', '#DCEDC8', '#C5E1A5', '#AED581', '#9CCC65', '#8BC34A', '#7CB342', '#689F38', '#558B2F', '#33691E'],
['#FFFDE7', '#FFF9C4', '#FFF59D', '#FFF176', '#FFEE58', '#FFEB3B', '#FDD835', '#FBC02D', '#F9A825', '#F57F17'],
['#FFF3E0', '#FFE0B2', '#FFCC80', '#FFB74D', '#FFA726', '#FF9800', '#FB8C00', '#F57C00', '#EF6C00', '#E65100'],
],
formatValue(value) {
return `rgba(${value.rgba.join(', ')})`;
},
}}
/>
</List>
Floating Labels
<List noHairlinesMd>
<ListInput
label="Name"
floatingLabel
type="text"
placeholder="Your name"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Password"
floatingLabel
type="password"
placeholder="Your password"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="E-mail"
floatingLabel
type="email"
placeholder="Your e-mail"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="URL"
floatingLabel
type="url"
placeholder="URL"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Phone"
floatingLabel
type="tel"
placeholder="Your phone number"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
label="Resizable"
floatingLabel
type="textarea"
resizable
placeholder="Bio"
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
</List>
Floating Labels + Outline Inputs
<List noHairlinesMd>
<ListInput
outline
label="Name"
floatingLabel
type="text"
placeholder="Your name"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
<ListInput
outline
label="Password"
floatingLabel
type="password"
placeholder="Your password"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
<ListInput
outline
label="E-mail"
floatingLabel
type="email"
placeholder="Your e-mail"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
<ListInput
outline
label="URL"
floatingLabel
type="url"
placeholder="URL"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
<ListInput
outline
label="Phone"
floatingLabel
type="tel"
placeholder="Your phone number"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
<ListInput
outline
label="Bio"
floatingLabel
type="textarea"
resizable
placeholder="Bio"
clearButton
>
<Icon icon="demo-list-icon" slot="media" />
</ListInput>
</List>
Validation + Additional Info
Icon + Input
<List noHairlinesMd>
<ListInput
type="text"
placeholder="Your name"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
type="password"
placeholder="Your password"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
type="email"
placeholder="Your e-mail"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
<ListInput
type="url"
placeholder="URL"
clearButton
>
<Icon icon="demo-list-icon" slot="media"/>
</ListInput>
</List>
Label + Input
<List noHairlinesMd>
<ListInput
label="Name"
type="text"
placeholder="Your name"
clearButton
/>
<ListInput
label="Password"
type="password"
placeholder="Your password"
clearButton
/>
<ListInput
label="E-mail"
type="email"
placeholder="Your e-mail"
clearButton
/>
<ListInput
label="URL"
type="url"
placeholder="URL"
clearButton
/>
</List>
Only Inputs
<List noHairlinesMd>
<ListInput
type="text"
placeholder="Your name"
clearButton
/>
<ListInput
type="password"
placeholder="Your password"
clearButton
/>
<ListInput
type="email"
placeholder="Your e-mail"
clearButton
/>
<ListInput
type="url"
placeholder="URL"
clearButton
/>
</List>
Inputs + Additional Info
Only Inputs Inset
<List inset>
<ListInput
type="text"
placeholder="Your name"
clearButton
/>
<ListInput
type="password"
placeholder="Your password"
clearButton
/>
<ListInput
type="email"
placeholder="Your e-mail"
clearButton
/>
<ListInput
type="url"
placeholder="URL"
clearButton