Skip to content

Commit b51f730

Browse files
authored
Merge pull request #602 from dxc-technology/component-select
Select documentation update
2 parents 5ba803d + f102c36 commit b51f730

File tree

9 files changed

+50
-59
lines changed

9 files changed

+50
-59
lines changed
1.09 MB
Binary file not shown.

guidelines/components/select/README.md

Lines changed: 50 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
A select component is a right choice to preventing errors with predefined options, also they reduce the vertical space by showing several options in a reduced space. Selects are used in forms, letting the user select an option instead using an input.
44

5-
## Appearance
5+
## Usage
66

7-
Select is widely recognizable, despite the options are not shown at the first instance, an icon with a down arrow indicates that clicking in the field the list will be visible. In the input, the placeholder defines the attribute that will get the value.
87

9-
* The options list will be displayed immediately above the placeholder, to get visible all the time which form fill attribute is the user filling.
10-
* In case that an option is selected when the dropdown turns visible, it should be at the top of the dropdown whenever this would be possible.
11-
* Multiple option selection will get an appearance with a checkbox that indicates the elements from the list that are selected or not.
8+
### Single select
9+
10+
- A dropdown element should allow the user to select one option from a list.
11+
- The select component should always display a label, different from any name in the option list.
12+
- If the options list is extensive, consider letting the user type for suggestions filtering the whole number of options.
13+
- A default choice can be displayed as the placeholder before user selection. It must be placed as the first item on the options list and appear selected.
14+
- Use progressive disclosure between linked select components.
15+
16+
### Multi-select
17+
18+
- If more than one option is applicable, a multi-selection box should be used.
19+
- If the list of options is short (4 or less) and users can select more than one option, consider using checkboxes instead of a multi-selection list for simplicity and visual clarity.
20+
- Multi-select fields include checkboxes for every single option in the list, the entire row must be clickable.
1221

1322

1423
## States
@@ -26,29 +35,49 @@ The options have two states: **enabled**, **hover**, **focus** and **selected**:
2635
![Option list states](images/select_option_states.png)
2736

2837

29-
3038
## Multiple selection
3139

3240
Allows the user to select more than one option from the list. To indicate which items are selected and which not, the design for multiple selections integrates a checkbox pairing with each option from the dropdown.
3341

3442
![Select multiple option](images/select_multi.png)
3543

44+
45+
## Required and error
46+
47+
* A required empty select should show an error message when submitted.
48+
* Helper text can be added to the component, [specs](https://developer.dxc.com/design/components/text-input) are available in the input component.
49+
50+
![Helper text](images/select_helper_text.png)
51+
3652
## Design Specifications
3753

54+
![Select specifications](images/select_specs.png)
55+
3856
### General
3957

4058
#### Color
4159

42-
| Tokens | Value |
43-
| ----------------------------- | ----------- |
44-
| `selectedOptionBackgroundColor` | #D9D9D9 |
45-
| `color` | #000000 |
46-
| `hoveredOptionBackgroundColor` | #F2F2F2 |
47-
| `error` | #D0011B |
48-
| `scrollBarThumbColor` | #666666 |
49-
| `scrollBarTrackColor` | #D9D9D9 |
50-
| `disabledColor` | #B1B1B1 |
51-
| `focusColor` | #005FCC |
60+
| Component token | Element | Core token | Value |
61+
| :-------------------------------- | :------------------------- | :----------------- | :--------- |
62+
| `assistiveTextFontColor` | Helper text | `color-black` | #000000 |
63+
| `labelFontColor` | Label | `color-black` | #000000 |
64+
| `disabledColor` | All:disabled | `color-black` | #000000 |
65+
| `errorColor` | Error message | `color-red-700` | #d0011b |
66+
| `optionBackgroundColor` | Option list dialog | `color-white` | #ffffff |
67+
| `optionFontColor` | Option list item | `color-black` | #000000 |
68+
| `scrollBarThumbColor` | Scroll bar | `color-grey-700` | #666666 |
69+
| `scrollBarTrackColor` | Scroll bar | `color-grey-500` | #999999 |
70+
| `optionIconColor` | Option list icon | `color-black` | #000000 |
71+
| `hoverOptionBackgroundColor` | Option list item:hover | `color-grey-100` | #f2f2f2 |
72+
| `activeOptionBackgroundColor` | Option list item:active | `color-grey-200` | #e6e6e6 |
73+
| `selectedOptionBackgroundColor` | Option list item:selected | `color-grey-300` | #cccccc |
74+
| `underlineColor` | Underline | `color-black` | #000000 |
75+
| `underlineFocusColor` | underline:focus | `color-black` | #000000 |
76+
| `valueFontColor` | Value | `color-black` | #000000 |
77+
| `valueIconColor` | Icon | `color-black` | #000000 |
78+
| `arrowColor` | Arrow | `color-black` | #000000 |
79+
| `focusColorOnDark` | Focus indicator | `color-blue-600` | #0095ff |
80+
5281

5382
#### Size
5483

@@ -111,61 +140,23 @@ Select input specifications are the same as the [text-input](https://developer.d
111140
| Focus outline `border-width` | 2px |
112141

113142

114-
![Select specifications](images/select_spec.png)
115143

116144
## Accessibility
117145

118146
### WCAG 2.2
119147

120-
**Understanding WCAG 2.2** - [SC 3.2.2: On Input](https://www.w3.org/WAI/WCAG22/Understanding/on-input.html)
121-
122-
* Changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component.
148+
* Understanding WCAG 2.2 - [SC 3.2.2: On Input](https://www.w3.org/WAI/WCAG22/Understanding/on-input.html)
123149

124150
### WAI-ARIA 2.1
125151

126-
**WAI-ARIA practices 2.1** - [3.14 Listbox](https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox)
127-
128-
* An element that contains or owns all the listbox options has role `listbox`.
129-
* Each option in the listbox has role `option` and is a DOM descendant of the element with role listbox or is referenced by an `aria-owns` property on the listbox element.
130-
* If the listbox is not part of another widget, then it has a visible label referenced by `aria-labelledby` on the element with role listbox.
131-
* In a single-select listbox, the selected option has `aria-selected` set to true.
132-
* If the listbox supports multiple selection:
133-
* The element with role `listbox` has `aria-multiselectable` set to true.
134-
* All selected options have `aria-selected` set to true.
135-
* All options that are not selected have `aria-selected` set to false.
136-
* If the complete set of available options is not present in the DOM due to dynamic loading as the user scrolls, their `aria-setsize` and `aria-posinset` attributes are set appropriately.
137-
* If options are arranged horizontally, the element with role `listbox` has `aria-orientation` set to horizontal. The default value of `aria-orientation` for listbox is vertical.
138-
139-
140-
## User Interface Design Considerations
141-
142-
### Single select
143-
144-
- A dropdown element should allow the user to select one option from a list.
145-
- The select component should always display a label, different from any name in the option list.
146-
- If the options list is extensive, consider letting the user type for suggestions filtering the whole number of options.
147-
- A default choice can be displayed as the placeholder before user selection. It must be placed as the first item on the options list and appear selected.
148-
- Use progressive disclosure between linked select components.
149-
150-
### Multi-select
151-
152-
- If more than one option is applicable, a multi-selection box should be used.
153-
- If the list of options is short (4 or less) and users can select more than one option, consider using checkboxes instead of a multi-selection list for simplicity and visual clarity.
154-
- Multi-select fields include checkboxes for every single option in the list, the entire row must be clickable.
155-
156-
## Required and error
157-
158-
* A required empty select should show an error message when submitted.
159-
* Helper text can be added to the component, [specs](https://developer.dxc.com/design/components/text-input) are available in the input component.
160-
161-
![Helper text](images/select_helper_text.png)
162-
163-
152+
* WAI-ARIA practices 2.1 - [3.14 Listbox](https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox)
164153

165154

166155
## Links and references
167156

168-
- https://xd.adobe.com/view/23e2cca4-5021-490a-a548-e99a9b4a2006-76b1/screen/5d47790c-8718-4e0a-acc4-3deea3a0a8fa/variables/
157+
* [React component](https://developer.dxc.com/tools/react/next/#/components/select)
158+
* [Angular component](https://developer.dxc.com/tools/angular/next/#/components/select)
159+
* [Adobe XD component](https://xd.adobe.com/view/af227d9a-92fa-4e32-b735-b1e914a9d447-fa71/)
169160

170161
____________________________________________________________
171162

3.15 KB
Loading
3.98 KB
Loading
1.26 KB
Loading
-28.7 KB
Binary file not shown.
41 KB
Loading
-2.82 KB
Loading
507 Bytes
Loading

0 commit comments

Comments
 (0)