Field
When to use this component
The field component is used to wrap form input components to provide layout.
How to use this component
Generally speaking you should not need to
call
onsField
yourself as it is already called from within form input components. However if you need to create a pattern or component that requires a field you can use
nunjucks' call functionality
onsField
.
The field will render as a <div>
with the class ons-field
.
Configuration
Name | Type | Required | Description |
---|---|---|---|
id | string | true | The id of the field |
classes | string | false | Classes to apply to the field |
attributes | object | false | HTML attributes (for example, data attributes) to add to the field |
error | Error (ref) |
false | Configuration for validation errors |
Help improve this component
Let us know how we could improve this component or share your user research findings. Discuss the ‘Field’ component on GitHub