Skip to main content
Version: 3.0

Fields

uniforms provide a set of predefined components that can be used as form fields.

The list below contains a guaranteed set of fields, implemented in every theme package:

ComponentDescription
AutoFieldAutomatically renders a given field.
AutoFieldsAutomatically renders given fields.
BoolFieldCheckbox.
DateFieldHTML5 date or datetime-local input.
ErrorFieldError message for a given field.
ErrorsFieldError message with a list of validation errors.
HiddenFieldHidden field (with a possibility to omit in DOM).
ListAddFieldAn icon with action to add a list item.
ListDelFieldAn icon with action to remove a list item.
ListFieldList of nested fields.
ListItemFieldSingle list item wrapper.
LongTextFieldTextarea.
NestFieldBlock of nested fields.
NumFieldNumeric input.
RadioFieldRadio checkbox.
SelectFieldSelect (or set of radio checkboxes).
SubmitFieldSubmit button.
TextFieldText (or any HTML5 compatible) input.

Fields

AutoField

AutoField is basically a field renderer - it will render a field of a type adequate to the one defined in the schema, according to the AutoField algorithm. You can also directly pass a component to it (by a component prop). All additional props will be passed to the result field component.

Props:
NameDefaultDescription
componentField according to the AutoField algorithmComponent to render
name-Name of the field in the schema
Props usage:
import { AutoField } from 'uniforms-unstyled';

<AutoField component={MyComponent} />;

AutoFields

AutoFields is basically a set of rendered AutoFields. By default, the rendered fields will be AutoField in a chosen theme. However, you can replace the standard AutoField with AutoField.componentDetectorContext. There is also an autoField prop, but it's deprecated and will be removed in a future release.

The element property defines a wrapping component. E.g. you want to group your fields inside a section, just do element="section". The default one is div.

Props:
NameDefaultDescription
autoFieldStandard AutoFieldAutoField component to render (see #980)
elementdivFields wrapper
fieldsAll schema fieldsList of fields to render
omitFields[]List of fields to omit
Props usage:
import { AutoFields } from 'uniforms-unstyled';

<AutoFields
autoField={MyAutoField}
element="section"
fields={['fieldA', 'fieldB']}
omitFields={['fieldA', 'fieldB']}
/>;

BoolField

A checkbox.

Props:
NameDescriptionAvailable in
appearanceField appearance. Set to "toggle" to appear as a Material Toggle or to "checkbox" (or leave it undefined) to use a Checkbox appearance.material
extraExtra feedback text. In the antd theme, this renders addtional help text below any validation messages.antd
feedbackableField feedback state. Some description would be great, huh?bootstrap3
gridField layout. Bootstrap grid layout style. Number is an equivalent of {sm: n}. Object is a {mode: size} object. Complete string is simply passed through.bootstrap3, bootstrap4, bootstrap5
helpHelp text. Some description would be great, huh?antd, bootstrap3, bootstrap4, bootstrap5
helpClassNameHelp block className. Some description would be great, huh?bootstrap3, bootstrap4, bootstrap5
inlineCheckbox inline state. In bootstrap themes, a label is rendered as a text but in inline mode, it's treated as a field label.bootstrap3, bootstrap4, bootstrap5
inputClassNameInput wrapper class name. In bootstrap themes, passed className is used on field block. This is used on direct field wrapper.bootstrap3, bootstrap4, bootstrap5
inputRefSetting ref prop to a field won't work as desired, because you'll receive a field component rather than an HTML input. If you need an input ref, use this prop instead.All
labelBeforeLeft label. In bootstrap themes, label is rendered on the right side of a checkbox. This label is rendered above the field.bootstrap3, bootstrap4, bootstrap5
labelClassNameLabel className. A custom className for the field's label.bootstrap3, bootstrap4, bootstrap5
labelColField layout. The layout of label. You can set span and/or offset.antd
showInlineErrorField inline error. Some description would be great, huh?antd, bootstrap3, bootstrap4, bootstrap5, semantic
wrapClassNameField and sourroundings wrap className. Some description would be great, huh?bootstrap3, bootstrap4, bootstrap5
wrapperColField layout. The layout for input controls. Same as labelCol.antd