You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/item.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,46 @@ import EncapsulationPill from '@components/page/api/EncapsulationPill';
19
19
20
20
Items are elements that can contain text, icons, avatars, images, inputs, and any other native or custom elements. Items should only be used as rows in a [list](./list) with other items. Items can be swiped, deleted, reordered, edited, and more.
21
21
22
+
## Content Types
23
+
24
+
Items in a list can support 5 different content types:
25
+
26
+
### Supporting Visuals
27
+
28
+
These are decorative icons or other adornments for an item. Since this content is not required to understand the intent of the row, they are typically hidden from screen readers using `aria-hidden="true"`
29
+
30
+
TODO Demo
31
+
32
+
### Text
33
+
34
+
The text content type includes form control labels or other visible text. This text serves to indicate the intent of the row. Try to keep the text short and to the point. If you find that you need more than a few sentences, consider moving the item to its own list and adding a [note](./note) at the bottom of the list.
35
+
36
+
TODO Demo
37
+
38
+
### Metadata
39
+
40
+
Metadata provides additional context for a row. Metadata can include information such as counts, badges, and more. Try to limit the amount of metadata you include to only the most relevant information. Adding too much metadata to a single item can overwhelm or confuse the user.
41
+
42
+
TODO Demo
43
+
44
+
### Actions
45
+
46
+
Actions are interactive elements that do something when you active them. An item can have primary and secondary actions displayed on a line. However, developers should ensure that each action's tap target is large enough to be usable.
47
+
48
+
Developers should be mindful when using actions and avoid creating [nested interactive](https://dequeuniversity.com/rules/axe/4.4/nested-interactive) which can break the user experience with screen readers. For example, developers should avoid adding a button inside the main content of `ion-item` if the `button` property is set to `true`.
49
+
50
+
If an item needs more than two actions, consider using the [item-sliding](./item-sliding) component with options.
51
+
52
+
TODO Demo
53
+
54
+
### Controls
55
+
56
+
Controls are form components such as checkboxes, inputs, radios, and more. Each item in a list should have at most two controls due to screen space constraints.
57
+
58
+
Metadata such as helper text or character counts should not be used on form controls in list views. If such metadata is needed, the form control should be placed outside of a list. If a form control needs additional context, consider adding a [note](./note) at the bottom of the list.
59
+
60
+
TODO Demo
61
+
22
62
## Basic Usage
23
63
24
64
Items left align text and add an ellipsis when the text is wider than the item. We can modify this behavior using the CSS Utilities provided by Ionic Framework, such as using `.ion-text-wrap` in the below example. See the [CSS Utilities Documentation](/docs/layout/css-utilities) for more classes that can be added to an item to transform the text.
@@ -132,6 +172,14 @@ import InputHighlight from '@site/static/usage/v7/item/theming/input-highlight/i
132
172
133
173
<InputHighlight />
134
174
175
+
## Usage Guidelines
176
+
177
+
The following guidelines will help ensure your list items are easy to understand and use.
178
+
179
+
1. Items should only be used inside of [lists](./list).
180
+
2. Items inside of a list should be presented in a consistent format. For example, if your items present decorative icons, the icons should be positioned in the same way between items.
181
+
3. Items should never render [nested interactives](https://dequeuniversity.com/rules/axe/4.4/nested-interactive). Screen readers are unable to select the correct interactive element when nested interactives are used. For example, avoid placing a button inside of an `ion-item` that has `button="true"`.
182
+
4. Use [content types](#content-types) correctly. The item component is designed to be a row in a [list](./list) and should not be used as a general purpose container.
0 commit comments