Skip to content

Commit d7675b4

Browse files
authored
docs(bulk-selection): Updates docs, images, and adds behavior guidance. (#4938)
* docs(bulk-selection): Updates the docs, images,, and adds more guidance around behavior. * Changes from PR review. * Update control in images.
1 parent ce84277 commit d7675b4

13 files changed

Lines changed: 613 additions & 25 deletions

packages/documentation-site/patternfly-docs/content/patterns/bulk-selection/bulk-selection.md

Lines changed: 90 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,113 @@
22
id: Bulk selection
33
section: patterns
44
---
5+
import '../../components/components.css';
56

6-
## Bulk selection
7-
Use a bulk selection pattern when you want to select or deselect multiple items in a content view (list, table, or card grid). The bulk selector uses a [split button](/components/menus/menu-toggle#split-button-toggle-with-checkbox) component to control selection from the [toolbar](/components/toolbar). Besides controlling selection, the bulk selector reflects the selection status of the related component (partially selected, all items selected, or no items selected).
7+
**Bulk selection** enables users to select or deselect multiple items in a content view, such as lists, tables, or card views.
88

99
## Bulk selector
10-
The bulk selector is created using a Split button and is always located as the leftmost item in a toolbar.
10+
You can add a bulk selection control in the toolbar of a content view. This control, a bulk selector, lets users control selection via a [split button](/components/menus/menu-toggle#split-button-toggle-with-checkbox) component. The bulk selector also reflects the selection status of the related content, including partial selection, full selection, or no selection.
1111

12-
<img src="./img/bulk-selector.png" alt="Bulk selector" />
12+
<div class="ws-docs-content-img">
13+
![Bulk selector with annotation pointers highlighting the split button: a checkbox on the left and a dropdown caret on the right with an open menu.](./img/bulk-selection.svg)
14+
</div>
1315

14-
**1. Bulk selector:** The bulk selector uses a split button to combine a selection checkbox with a dropdown menu.
16+
1. **Bulk selector:** A split button that combines a selection checkbox with a dropdown menu toggle.
1517

16-
**2. Checkbox:** The state of the checkbox reflects the current selection state of the list, table, or card grid.
18+
2. **Menu:** A list of bulk selection options for the related content view. A bulk selection menu should include the following options:
19+
- "Select none", which clears a previous selection. If nothing is selected, this option should be disabled.
20+
- "Select page", which selects all items on the current page (when pagination is in use).
21+
- "Select all", which selects all items across all pages. This can be omitted if this isn't supported in your implementation.
22+
- (Optionally) Additional menu items that match some predetermined filter criteria, such as “Running VMs”, "Errors”, and so on.
1723

18-
<img src="./img/bulk-select-checkbox.png" alt="Bulk Selector Checkbox States" width="518"/>
24+
<div class="ws-docs-content-img">
25+
![Annotation pointers highlighting the relationship between the bulk selector checkbox and the individual row checkboxes (selected, partially selected, and unselected).](./img/bulk-selection-selected.svg)
26+
</div>
1927

20-
**3. Items selected:** This text always reflects the total number of items selected. If pagination is in use, it will reflect the items selected across all pages.
28+
1. **Checkbox:** Control that reflects the current selection state of the item. Checkbox states will be automatically updated by bulk selector menu selections, but can also be manually selected. Manually clicking the checkbox in the bulk selector will select all items in the related content view.
2129

22-
**4. Menu:** at a minimum the menu will include:
23-
* Select none - to clear selections across all pages.
24-
* Select page - to select all items on the current page (when pagination is in use).
25-
* Select all - to select all items across pages.
30+
2. **Selected item count:** Text label that reflects the total number of items selected. If pagination is in use, it will reflect the number of items selected across all pages.
2631

27-
Additional menu items can be added to select items that match some predetermined filter criteria, such as “Red Cars or Blue Cars” / “Running VMs”, etc.
32+
3. **Selected checkbox:** Indicates that an item has been selected. Either a partial selection (dash) or a full selection (check mark) can be displayed in a checkbox. For more details about the behavior of the checkbox, refer to [checkbox states](#checkbox-states).
33+
34+
4. **Empty checkbox:** Indicates that an item has not been selected.
2835

2936
## Usage
30-
### Bulk selection from the toolbar
31-
The example below shows a bulk selector placed in a toolbar above a table using pagination.
3237

33-
<img src="./img/bulk-selection-example.png" alt="Bulk selection from toolbar" />
38+
### Selection in toolbars
39+
A bulk selector is often placed in the toolbar of a table that uses pagination.
40+
41+
<div class="ws-docs-content-img">
42+
![A table toolbar showing the bulk selection menu expanded, with options to select none, page, or all.](./img/bulk-selection-toolbar.svg)
43+
</div>
44+
45+
In this example, there are 50 total items in this dataset across 10 pages. Only the first page has been selected, so partial selection is reflected across checkboxes. The user can select (or deselect) additional items via the bulk selection checkbox, the bulk selection menu, or by clicking on a row's checkbox. The selected items count will update whenever selection is changed.
46+
47+
### Selection for global actions
48+
Bulk selection is often used to select multiple items and perform an action on them. In these instances, the selection state persists&mdash;even after the action has completed&mdash;until the user purposefully changes the selection.
49+
50+
### Integrated selection for tables
51+
Tables include integrated bulk selection by default in the header row.
52+
53+
<div class="ws-docs-content-img">
54+
![A table header row showing the integrated bulk selection checkbox at the start of the row.](./img/bulk-selection-table.svg)
55+
</div>
56+
57+
A checkbox in a table's header row will select or deselect all items in the table (or all items on the current page if pagination is in use).
58+
59+
We recommend only using integrated bulk selection when a table doesn't contain a toolbar. When a toolbar is present, you should instead default to controlling bulk selection via the toolbar. This provides better visibility for the number of selected item, maintains better consistency between view types, and allows for more selection flexibility.
60+
61+
**Note:** To hide integrated bulk selection and enable the toolbar control in our [table component](/components/table), set the `canSelectAll` prop to "false".
62+
63+
## Behavior
64+
65+
### Checkbox states
66+
67+
<div class="ws-docs-content-img">
68+
![Four bulk selector states: disabled (gray), partial selection (minus icon), unchecked (empty), and full selection (check mark).](./img/checkbox-states.svg)
69+
</div>
70+
71+
There are a few checkbox states that can result from bulk selection:
72+
73+
1. **Disabled:** Cannot be interacted with.
74+
2. **Partial selection:** Uses the minus icon to represent that the item is part of a partial selection, meaning that only some items are selected.
75+
3. **Unchecked:** Represents that the item hasn't been selected.
76+
4. **Full selection:** Uses the check mark icon to represent that the item is part of a full selection, where all items are selected in a content view.
77+
78+
#### No items selected
79+
80+
<div class="ws-docs-content-img">
81+
![Annotated bulk selector in the "None selected" state; the checkbox is empty and the "Select none" menu option is disabled.](./img/empty-selection.svg)
82+
</div>
83+
84+
1. **Checkbox:** Empty. When clicked, selects all items.
85+
2. **Menu toggle:** Opens and closes the selection menu.
86+
3. **Menu:** Displays selection options. "Select none" is disabled, since no items are selected.
87+
88+
#### Some items selected
89+
90+
<div class="ws-docs-content-img">
91+
![Annotated bulk selector in the "Partial selection" state; the checkbox shows a minus icon and the text label indicates the number of items selected.](./img/partial-selection.svg)
92+
</div>
3493

35-
There are 50 total items in this dataset spread across 10 pages (5 items per page), but only the first page has been selected and therefore partial selection is reflected in the checkbox. The user may select (or deselect) additional items either through the use of the bulk selection checkbox, the bulk selection menu, or by clicking on the checkbox at the front of a row. The selected items count will update whenever selection is changed.
94+
1. **Checkbox:** Filled, containing a minus icon. When clicked, deselects all selected items.
95+
2. **Text label:** Displays the number of selected items. When clicked, opens and closes the selection menu.
96+
3. **Menu toggle:** Opens and closes the selection menu.
97+
4. **Menu:** Displays selection options.
3698

37-
### Bulk selection and global actions
38-
Bulk selection is often used to select multiple items and perform an action on them. Note that after an action is completed, the selection state remains as is until the user changes the selection.
99+
The following guidance outlines the behavior of the bulk selector for different selection states.
39100

40-
### Integrated bulk selection for tables
41-
Tables are unique to other view in that they include integrated bulk selection by default. Below is an example of a PatternFly table component with integrated bulk selection in the header row.
101+
#### All items selected
42102

43-
<img src="./img/bulk-selection-no-toolbar.png" alt="Integrated bulk selection in a table" />
103+
<div class="ws-docs-content-img">
104+
![Annotated bulk selector in the "Full selection" state; the checkbox shows a check mark icon and the text label indicates all items are selected.](./img/full-selection.svg)
105+
</div>
44106

45-
**1. Bulk selection checkbox:** A checkbox in the header row of a table will select (or deselect) all items in the table or all items on the current page if pagination is in use.
107+
1. **Checkbox:** Filled, containing a check mark icon. When clicked, deselects all selected items.
108+
2. **Text label:** Displays the number of selected items. When clicked, opens and closes the selection menu.
109+
3. **Menu toggle:** Opens and closes the selection menu.
110+
4. **Menu:** Displays selection options.
46111

47-
In PatternFly we recommend that integrated bulk selection only be used in cases where a table is placed in a page without a toolbar. Whenever a toolbar is present, we recommend using the toolbar to control bulk selection. This will provide for better visibility on the count of selected items, lead to better consistency between view types, and allow for more variety of selection options.
112+
## Placement
48113

49-
Note: To hide integrated bulk selection and enable selection control from the toolbar in the PatternFly React Table component, set the canSelectAll prop to ‘false’.
114+
When used in a toolbar, the bulk selector should be the first item.

0 commit comments

Comments
 (0)