Skip to content

Commit

Permalink
Updated Optional versus required fields section (carbon-design-system…
Browse files Browse the repository at this point in the history
…#2528)

Updated documentation to include the use of (required) as well as (optional).

Co-authored-by: Lauren Rice <43969356+laurenmrice@users.noreply.github.com>
  • Loading branch information
jjennings7 and laurenmrice authored Sep 27, 2021
1 parent 1a16390 commit 5803951
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/pages/components/form/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,29 @@ characters."_

### Optional versus required fields

All fields in a form are assumed required, with optional fields being tagged as
so. It is recommended that an instruction precedes the form stating either "All
fields are required" or "All fields are required unless marked optional".
When designing your form, consider the purpose and the use case, and note if the majority of the fields are **required** or **optional**

- If the majority of the fields are required, mark **only** the optional fields with (optional). 
- If the majority of the fields are optional, mark **only** the required fields  with (required). 

Using the appropriate pattern based on the use case will reduce visual noise and clutter; helping your users to more quickly and accurately complete the form. It will also ensure consistency through and across products. 

If you choose to mark only optional form fields, it is recommended that an instruction precedes the form stating either “All fields are required” or “All fields are required unless marked optional”. 

<Row>
<Column colLg={8}>

![Example of a short user sign-up form using the Optional pattern](https://user-images.githubusercontent.com/48838320/131397684-0882cf1e-90b8-4029-ac26-bc111329f323.png)
Example of a short user sign-up form using the Optional pattern

</Column>
</Row>

<Row>
<Column colLg={8}>

![optional fields in a form](images/form-usage-5.png)
![Example of product configuration properties using the Required pattern](https://user-images.githubusercontent.com/48838320/131397758-015ea0ea-e3ba-4a67-947b-e4215235e2b5.png)
Example of product configuration properties using the Required pattern

</Column>
</Row>
Expand Down

0 comments on commit 5803951

Please sign in to comment.