Skip to main content

User testing

Help us improve this service. Take part in a short online exercise


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.


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