Forms
Forms are used to collect data from users. They are an essential part of any website or application, as they allow users to input and submit data. They are also used to make filters, searches, and other actions.
Forms are crucial in web development as they enable users to input and submit data, significantly shaping the user experience. ravixUI employs semantic HTML for all form components, ensuring their accessibility. However, it’s important to note that while the form elements themselves are accessible, there are numerous additional factors beyond the components that must be addressed to guarantee the overall accessibility of forms.
For a deeper understanding of how to make forms accessible, you can refer to the tutorial on forms provided by W3C . Since forms require user input and data, there maybe some additional considerations that need to be satisfied based on the use case.
Form Components
Forms are usually made up of labels and input fields with action buttons. Some of the commonly used form components are:
- Text Fields: Used to collect data in text format from users.
- Select Fields: Used when you want to limit the user’s input to a specific set of options.
- Checkbox Fields: Used to collect user preferences or when a user can select multiple options.
- Radio Buttons: Used to collect data in a radio button format from users.
- Buttons: Used to submit/reset the form or trigger another type of action.
Note: ravixUI only provides the basic form components out of the box. It does not provide any validation, sanization, or error handling. You will need to implement these yourself including connecting the form to a backend.
Text Fields
Text fields are multipurpose input fields that can be used for collecting text data from users. Some of the commonly used text fields are given below:
Note: Placeholders are used only for non critical fields to provide additional information. For important fields, another div/span is used to display the information and is connected to the input field using aria-describedby
.
Select Fields
Select fields are used when you want to limit the user’s input when there are multiple options to choose from.
Checkbox Fields
Checkbox fields are used to collect user preferences or when a user can select multiple options.
Radio Buttons
Radio buttons are a great way to ensure the user selects only one option from a group of choices.
Form Buttons
A few buttons which have types assigned to them for reset and submit.