-
Notifications
You must be signed in to change notification settings - Fork 120
chore: update form docs #4349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: update form docs #4349
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
View your CI Pipeline Execution ↗ for commit d999a96
☁️ Nx Cloud last updated this comment at |
View your CI Pipeline Execution ↗ for commit 63c6faf.
☁️ Nx Cloud last updated this comment at |
Size Change: 0 B Total Size: 1.13 MB ℹ️ View Unchanged
|
Paste
|
Project |
Paste
|
Branch Review |
docs/form-layout
|
Run status |
|
Run duration | 04m 15s |
Commit |
|
Committer | “nora |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
69
|
View all changes introduced in this branch ↗︎ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d999a96:
|
63c6faf
to
be42b0d
Compare
ffeaaf7
to
d999a96
Compare
@@ -107,8 +111,7 @@ A checkbox is always displayed next to a visible label. | |||
|
|||
### Checkbox with help text | |||
|
|||
In cases where the checkbox requires additional context, you can display this information as help text below the checkbox control and label. This can help keep checkbox labels concise. In order to maintain styling consistency, be sure to use the `helpText` prop here instead of using the Help Text component. | |||
|
|||
Use Checkbox with Help Text in cases where the checkbox requires additional context. In order to maintain styling consistency, be sure to use the `helpText` prop here instead of using the Help Text component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Checkbox with Help Text in cases where the checkbox requires additional context. In order to maintain styling consistency, be sure to use the `helpText` prop here instead of using the Help Text component. | |
Use Checkbox with help text in cases where the checkbox requires additional context. In order to maintain styling consistency, be sure to use the `helpText` prop here instead of using the Help Text component. |
- The label may be visually hidden or provided via `aria-label` on the group component if the entire form is just a single checkbox group with no other form elements. The grouping should be visually implicit, but a description still needs to be provided for assistive technology. | ||
- Checkbox Group must have a group legend that describes the collection. The label should be visible. However if the entire form is just a single checkbox group with no other form elements, it may be visually hidden or provided via `aria-label` on the group component. The grouping should be visually implicit, but a description still needs to be provided for assistive technology. | ||
- Checkbox must have a visible label. | ||
- When displaying additional content based on checking a checkbox, be sure that the new content appears after the checkbox so that it is naturally discoverable by assistive technology users. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: Remove the sections below ("Checkbox" and "Accessibility") since they repeat what's above it.
@@ -117,17 +120,29 @@ In cases where the checkbox requires additional context, you can display this in | |||
|
|||
### Required checkbox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Required checkbox | |
### Required Checkbox |
</LivePreview> | ||
|
||
## Checkbox Group examples | ||
|
||
### Basic checkbox group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Basic checkbox group | |
### Basic Checkbox Group |
@@ -145,7 +160,7 @@ Multiple checkboxes and their labels are grouped together with a common group co | |||
|
|||
### Checkbox group with help text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Checkbox group with help text | |
### Checkbox Group with help text |
@@ -145,7 +160,7 @@ Multiple checkboxes and their labels are grouped together with a common group co | |||
|
|||
### Checkbox group with help text | |||
|
|||
You can provide additional information about the group with the use of help text. Help text can appear after the group label but before the first group member. Each item in the group may also provide their own, individual help text. | |||
Use help text to give more context about a Checkbox group. In order to maintain styling consistency, be sure to use the helpText prop here instead of using the Help Text component. Individual checkboxes can also include their own help text if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use help text to give more context about a Checkbox group. In order to maintain styling consistency, be sure to use the helpText prop here instead of using the Help Text component. Individual checkboxes can also include their own help text if needed. | |
Use help text to give more context about a Checkbox group. In order to maintain styling consistency, be sure to use the `helpText` prop here instead of using the Help Text component. Individual checkboxes can also include their own help text if needed. |
</Checkbox> | ||
</CheckboxGroup>`} | ||
</LivePreview> | ||
|
||
### Checkbox group with an inline error | ||
### Checkbox group with an error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Checkbox group with an error | |
### Checkbox Group with an error |
|
||
Use the Form component to arrange a layout of form elements with preset spacing. | ||
The Form component renders an HTML form element and comes with default behavior from the browser ([learn more about HTML form elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)). Form elements are displayed vertically by default, but also support horizontal and 2-column layouts. | ||
Use the Form Layout component to arrange a layout of form elements with preset spacing. Refer to our [form pattern](/patterns/form) for additional guidance on types of forms and common form fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the Form Layout component to arrange a layout of form elements with preset spacing. Refer to our [form pattern](/patterns/form) for additional guidance on types of forms and common form fields. | |
Use the Form Layout component to arrange a layout of form elements with preset spacing. Refer to our [Form pattern](/patterns/form) for additional guidance on types of forms and common form fields. |
If the input has any associated help text, the input should also use the <InlineCode>aria-describedby</InlineCode>{' '} | ||
prop that equals the <InlineCode>id</InlineCode> of the help text. This ensures screen readers know the help text | ||
ties directly to the input. | ||
Check accessibility for each form element component—for example, follow [Time Picker accessibility guidelines](https://paste.twilio.design/components/time-picker#accessibility). You can also refer to the [WCAG Forms Tutorial](https://www.w3.org/WAI/tutorials/forms/) for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: Need to use the Anchor component here
### Sections | ||
|
||
Use sections to group related content or steps within a Form. A section is separated using a [Separator](/components/separator), with `$space-90` above and below it. | ||
### Form Layouts with sections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Form Layouts with sections | |
### Form Layout with sections |
The Form component ensures there is adequate spacing between form elements so users know which label belongs to which input. Typically, 50-75% of the height of a form element helps create this adequate spacing, so we’ve chosen to use `$space-80` between all form elements. | ||
|
||
#### Single column vs. multiple columns | ||
Designing a good form requires making decisions about composition, sequence, form elements, content, and feedback. Use the [form pattern](/patterns/form) for further guidance on form order and organization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Designing a good form requires making decisions about composition, sequence, form elements, content, and feedback. Use the [form pattern](/patterns/form) for further guidance on form order and organization. | |
Designing a good form requires making decisions about composition, sequence, form elements, content, and feedback. Use the [Form pattern](/patterns/form) for further guidance on form order and organization. |
|
||
### Composing a form | ||
<DetailText>Do keep all the form elements left aligned. Avoid adding any left padding to the form fields or form actions.</DetailText> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<DetailText>Do keep all the form elements left aligned. Avoid adding any left padding to the form fields or form actions.</DetailText> | |
<DetailText marginTop='space0'>Keep all form elements left-aligned. Avoid adding any left padding to the form fields or form actions.</DetailText> |
Uh oh!
There was an error while loading. Please reload this page.