- Button
- Checkbox
- CurrencyInput
- Dropzone
- FileInput
- RadioGroup
- RadioButtonGroup
- SelectInput
- TextArea
- TextInput
- ToggleSwitch
contents
: A string or an element; displays on the inside of theButton
.id
: A unique string to give the Button an ID. Especially important if theButton
triggers a modal or other elements where it's needed for accessibility.onClick
: A function to be triggered when theButton
is clicked.
className
: A string to style theButton
.loading
: A boolean indicating if something on the page is loading that should preventButton
click events.loadingElement
: A React Element containing a spinner or other loading indicator in case you don't want to use the bloom-forms default spinner.
<Button contents='Click me' onClick={ this.renderStuff } id='example-button' className='Btn--small' />
checked
: A boolean for if the element is checked or not. Usually populated likeformData.field.value
.name
: A string that should match one of the string infieldNames
passed into<Form>
. Also used as the checkbox's ID.label
: Either a string or an element to label the checkbox. Hidden by default, but always required for accessibility purposes.onChange
: A function that fires when the checkbox is clicked. UsuallyupdateForm
.
className
: A string for styling the checkbox input.containerClass
: A string for styling the entire div around the input and its label.errors
: A string for displaying errors. Usually populated likeformData.field.error
.labelClass
: A string for styling the label text.onBlur
: A function that fires when theCheckbox
loses focus. Usually fires validation viacheckField
.required
: A boolean indicating if the input value can't be empty.showLabel
: A boolean showing or hiding the label text. By default, all bloom forms input labels are hidden.showLabelBeforeCheckbox
: A boolean reversing the display order of checkbox and label text.validateAs
: A string tying into the validation help passed in to the wrapper<Form>
. Examples include 'not-empty', 'zip', and 'number'.
CurrencyInput is a special TextInput that always validates as a number and displays the type of currency in the background of the input.
currency
: A string noting the type of currency. Typically 'ETH', 'BTC', etc.id
: A string that becomes the input's ID.label
: Either a string or a React element that labels theCurrencyInput
. Required for accessibility purposes, but hidden by default.name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.onChange
: A function used to update theCurrencyInput
's value. Generally, this should beupdateForm
.value
: A string holding the value of theCurrencyInput
. Generally passed in likeformData.field.value
.
className
: A string for styling the currency input.containerClass
: A string for styling the entire div around the input and its label.error
: A string usually passed in directly fromformData
that notes an error with that field validation. Generally passed in likeformData.field.error
.labelClass
: A string that styles just the label text.placeholder
: A string that shows up in the background of theCurrencyInput
when its value is empty.onBlur
: A function that fires when focus leaves the element. Usually used tocheckField
.required
: A boolean indicating if the input value can't be empty.- showLabel: A boolean showing or hiding the label text. By default, all bloom forms input labels are hidden.
A file input that supports drag and drop and multiple files. Forked and reworked for our purposes from 'react-dropzone'.
files
: An array of File objects. Should be passed in likeformData.field.value
, as file inputs append an array of Files to the redux store.label
: A string that labels theDropzone
. Required for accessibility purposes, but hidden by default.name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.onChange
: A function used to update theDropzone
's value. Generally, this should bemanualFieldUpdate
.
accept
: A string limiting the file types accepted. Native HTML5 'accept' attribute on input type='file'.containerClass
: A string for styling the entire div around the input and its label.imageStyle
: An object with CSS for styling the preview images of any uploaded files. Will fall back to default styles if not defined.loadingElement
: A React Element containing a spinner or other loading indicator in case you don't want to use the bloom-forms default spinner.multiple
: A boolean allowing multiple files to be uploaded simultaneously. Defaults totrue
.required
: A boolean indicating if the input value can't be empty.
Inline file input that does not support drag and drop.
formId
: A string that matches the id passed into your wrapper<Form>
.label
: A string labelling yourFileInput
. Required for accessibility purposes, but hidden by default.id
: A string giving theFileInput
its ID.name
: A string tying theFileInput
's value to theformData
. Also sets thename
prop of each element in the group.onChange
: A function used to update theFileInput
's value. Generally, this should bemanualFieldUpdate
.
accept
: A string limiting the file types accepted. Native HTML5 'accept' attribute on input type='file'.containerClass
: A string for styling the entire div around the input and its label.error
: A string for displaying errorsmultiple
: A boolean allowing multiple files to be uploaded simultaneously.onBlur
:required
:
and
Both RadioGroup and RadioButtonGroup are used when there are a variety of options, but only one can be selected at once. RadioButtonGroup behaves nearly identically to RadioGroup but has the styling of buttons.
name
: A string tying theRadioGroup
's value to theformData
. Also sets thename
prop of each element in the group.onChange
: A function used to update theRadioGroup
's value. Generally, this should beupdateForm
.options
: An array of radio options, with each one looking like:{ id: string, label: either a string or a react element }
value
: A string mapped to theRadioGroup
's value informData
.
className
: A string to style each radio input.containerClass
: A string to style the entire component wrapper.error
: A string usually passed in directly fromformData
that notes an error with that field validation. Generally passed in likeformData.field.error
.labelClass
: A string that styles only the label text of each radio input.onBlur
: A function that fires when focus leaves the element. Usually used tocheckField
.required
: A boolean indicating if the input value can't be empty.validateAs
: A string tying into the validation help passed in to the wrapper<Form>
. Examples include 'not-empty', 'zip', and 'number'.
formId
: A string that matches the id passed into your wrapper<Form>
.label
: A string labelling your select input. Required for accessibility purposes, but hidden by default.name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.onChange
: A function used to update theSelectInput
's value. Generally, this should bemanualFieldUpdate
.options
: An array of either strings, or an object of type: { label: string, value: number or string }. These populate yourSelectInput
options.value
: Either a number or string holding the value of theSelectInput
. Generally passed in likeformData.field.value
.
containerClass
: A string to style the entire select input container. Shows up on<label>
in the DOM.error
: A string usually passed in directly fromformData
that notes an error with that field validation. Generally passed in likeformData.field.error
.loading
: A boolean indicating if an ajax request is populating the options of your SelectInput.onBlur
: A function that fires when focus leaves the element. Usually used tocheckField
.required
: A boolean indicating if the input value can't be empty.showLabel
: A boolean showing or hiding the label text. By default, all bloom forms input labels are hidden.typeAhead
: A boolean indicating if theSelectInput
should have typeahead functionality. If set to false, typing letter characters has no effect on results.validateAs
: A string tying into the validation help passed in to the wrapper<Form>
. Examples include 'not-empty', 'zip', and 'number'.
TextArea is a multi-line text input for large amounts of text. Uses HTML5 <textarea>
.
label
: Either a string or a React element that labels theTextArea
. Required for accessibility purposes, but hidden by default.name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.onChange
: A function used to update theTextArea
's value. Generally, this should beupdateForm
.value
: A string holding the value of theTextArea
. Generally passed in likeformData.field.value
.
className
: A string that styles the input box directly.containerClass
: A string for styling the entire div around the input and its label.error
: A string usually passed in directly fromformData
that notes an error with that field validation. Generally passed in likeformData.field.error
.labelClass
: A string that styles only the label text of theTextArea
.placeholder
: A string that shows up in the background of theTextArea
when its value is empty.onBlur
: A function that fires when focus leaves the element. Usually used tocheckField
.required
: A boolean indicating if the input value can't be empty.showLabel
: A boolean showing or hiding the label text. By default, all bloom forms input labels are hidden.validateAs
: A string tying into the validation help passed in to the wrapper<Form>
. Examples include 'not-empty', 'zip', and 'number'.
TextInput is a single line text input used most often in forms.
label
: Either a string or a React element that labels theTextInput
. Required for accessibility purposes, but hidden by default.name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.onChange
: A function used to update theTextInput
's value. Generally, this should beupdateForm
.value
: A string holding the value of theTextInput
. Generally passed in likeformData.field.value
.
className
: A string that styles the input box directly.containerClass
: A string that styles the wrapper around the entire component.error
: A string usually passed in directly fromformData
that notes an error with that field validation. Generally passed in likeformData.field.error
.isPassword
: A boolean that, when true, obfuscates all characters entered into the input and makes them appear as dots.labelClass
: A string that styles only the label text of theTextInput
.placeholder
: A string that shows up in the background of theTextInput
when its value is empty.onBlur
: A function that fires when focus leaves the element. Usually used tocheckField
.onKeyDown
: A function capturing a keydown event.required
: A boolean indicating if the input value can't be empty.showLabel
: A boolean showing or hiding the label text. By default, all bloom forms input labels are hidden.validateAs
: A string tying into the validation help passed in to the wrapper<Form>
. Examples include 'not-empty', 'zip', and 'number'.
The ToggleSwitch is a hidden checkbox that appears in the UI like a sideways light switch. In the DOM, it looks either 'on' or 'off' depending on the isActive
prop.
name
: A string tying theformData
to the input's value. It should match one of the strings infieldNames
array passed into<Form>
.isActive
: A boolean that indicates if theToggleSwitch
is 'on' or 'off'.labelText
: A string that labels theToggleSwitch
.onClick
: A function that changes the value of the corresponding field informData
. Usually passed in likemanualFieldUpdate('example-form-id', 'toggle-switch-name', !formData['toggle-switch-name'].value)
className
: A string that styles the toggle switch.disabled
: A boolean that, when true, prevents the onClick event from firing and leaves theToggleSwitch
in 'off' position.innerLabels
: An object that allows you to display text for 'on' and 'off' inside theToggleSwitch
. An example object might look like:{ on: 'true', off: 'false' }
required
: A boolean indicating if the input value can't be empty. HTML checkboxes don't support this fully, so it's only used for UX display purposes.