Skip to content

Commit f30f5d8

Browse files
Material Design Teamdsn5ft
authored andcommitted
[Loading Indicator] Update documentation to align with Material 3 spec.
Restructures the LoadingIndicator component documentation to improve clarity, add more context, and align with Material 3. - Adds a Table of Contents for better navigation. - Links to the official M3 spec for overview and guidelines. - Adds new sections for Anatomy and M3 Expressive with corresponding images. - Improves the component definition and clarifies usage. PiperOrigin-RevId: 787630502
1 parent b4e08ad commit f30f5d8

File tree

3 files changed

+78
-54
lines changed

3 files changed

+78
-54
lines changed

docs/components/LoadingIndicator.md

Lines changed: 78 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,75 @@ path: /catalog/loading-indicators/
99

1010
# Loading Indicators
1111

12-
Loading indicators express an unspecified wait time of a process.
12+
[Loading indicators](https://m3.material.io/components/loading-indicator/overview)
13+
show the progress for a short wait time. It has two configurations.
1314

14-
![Animation of loading indicator](assets/loadingindicator/loading_indicator.gif)
15+
![Loading indicator configurations](assets/loadingindicator/loadingindicator-configurations.gif)
1516

16-
**Contents**
17+
1. Default (contained)
18+
2. Uncontained
1719

18-
* [Using loading indicators](#using-progress-indicators)
19-
* [Anatomy and key properties](#anatomy-and-key-properties)
20+
**Note:** Images use various dynamic color schemes.
2021

21-
## Using loading indicators
22+
## Design & API documentation
23+
24+
* [Material 3 (M3) spec](https://m3.material.io/components/loading-indicator/overview)
25+
26+
## Anatomy
27+
28+
![Loading indicator anatomy](assets/loadingindicator/anatomy.png)
29+
30+
1. Active indicator
31+
2. Container (optional)
32+
33+
More details on anatomy items in the
34+
[component guidelines](https://m3.material.io/components/loading-indicator/guidelines#a6bb9df2-568a-41d4-a4e9-08ac8f844a7d).
35+
36+
## M3 Expressive
37+
38+
### M3 Expressive update
39+
40+
The loading indicator is a new component added to the library in the M3
41+
Expressive update.
42+
43+
The loading indicator is designed to show progress that loads in under five
44+
seconds. It should replace most uses of the indeterminate circular progress
45+
indicator.
46+
[More on M3 Expressive](https://m3.material.io/blog/building-with-m3-expressive)
47+
48+
**Loading indicators:**
49+
50+
* Can be contained or uncontained
51+
* Use shape and motion to capture attention
52+
* Can scale in size
53+
54+
## Key properties
55+
56+
#### Attributes
57+
58+
Element | Attribute | Related method(s) | Default value
59+
-------------------- | --------------------- | --------------------------------------------- | -------------
60+
**Indicator color** | `app:indicatorColor` | `setIndicatorColor`</br>`getIndicatorColor` | `colorPrimary`
61+
**Container color** | `app:containerColor` | `setContainerColor`</br>`getContainerColor` | `transparent`
62+
**Indicator size** | `app:indicatorSize` | `setIndicatorSize`</br>`getIndicatorSize` | 38dp
63+
**Container width** | `app:containerWidth` | `setContainerWidth`</br>`getContainerWidth` | 48dp
64+
**Container height** | `app:containerHeight` | `setContainerHeight`</br>`getContainerHeight` | 48dp
65+
66+
#### Styles
67+
68+
Element | Style
69+
------------------- | ---------------------------------------------
70+
**Default style** | `Widget.Material3.LoadingIndicator`
71+
**Contained style** | `Widget.Material3.LoadingIndicator.Contained`
72+
73+
Default theme attribute: `?attr/loadingIndicatorStyle`
74+
75+
See the full list of
76+
[styles](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/res/values/styles.xml)
77+
and
78+
[attributes](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/res/values/attrs.xml).
79+
80+
## Code implementation
2281

2382
Before you can use Material loading indicators, you need to add a dependency to
2483
the Material Components for Android library. For more information, go to the
@@ -34,7 +93,17 @@ indeterminate circular progress indicators.
3493
**Note:** Use progress indicators, if the processes can transition from
3594
indeterminate to determinate.
3695

37-
### Usage
96+
### Adding loading indicators
97+
98+
Loading indicators capture attention through motion. It morphs the shape in a
99+
sequence with potential color change, if multiple colors are specified for the
100+
indicator. A fully rounded container is optionally drawn behind the morphing
101+
shape.
102+
103+
Source code:
104+
105+
* `LoadingIndicator`
106+
* [Class source](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/LoadingIndicator.java)
38107

39108
A loading indicator can be added to a layout:
40109

@@ -59,8 +128,8 @@ A loading indicator can be added to a layout:
59128

60129
### Making loading indicators accessible
61130

62-
Loading indicators have support very limited user interactions. Please consider
63-
setting the content descriptor for use with screen readers.
131+
Loading indicators have limited support for user interactions. Please
132+
consider setting the content descriptor for use with screen readers.
64133

65134
That can be done in XML via the `android:contentDescription` attribute or
66135
programmatically like so:
@@ -71,48 +140,3 @@ loadingIndicator.contentDescription = contentDescription
71140

72141
For contained loading indicators, please ensure the indicator color and the
73142
container color have enough contrast (3:1).
74-
75-
## Loading indicators
76-
77-
Loading indicators capture attention through motion. It morphs the shape in a
78-
sequence with potential color change, if multiple colors are specified for the
79-
indicator. A fully rounded container is optionally drawn behind the morphing
80-
shape.
81-
82-
Source code:
83-
84-
* `LoadingIndicator`
85-
* [Class source](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/LoadingIndicator.java)
86-
87-
### Anatomy and key properties
88-
89-
A loading indicator consists of an optional container and an indicator.
90-
91-
![Loading indicator anatomy](assets/loadingindicator/anatomy.png)
92-
93-
1. Active indicator
94-
2. Container
95-
96-
#### Attributes
97-
98-
Element | Attribute | Related method(s) | Default value
99-
-------------------- | --------------------- | --------------------------------------------- | -------------
100-
**Indicator color** | `app:indicatorColor` | `setIndicatorColor`</br>`getIndicatorColor` | `colorPrimary`
101-
**Container color** | `app:containerColor` | `setContainerColor`</br>`getContainerColor` | `transparent`
102-
**Indicator size** | `app:indicatorSize` | `setIndicatorSize`</br>`getIndicatorSize` | 38dp
103-
**Container width** | `app:containerWidth` | `setContainerWidth`</br>`getContainerWidth` | 48dp
104-
**Container height** | `app:containerHeight` | `setContainerHeight`</br>`getContainerHeight` | 48dp
105-
106-
#### Styles
107-
108-
Element | Style
109-
------------------- | ---------------------------------------------
110-
**Default style** | `Widget.Material3.LoadingIndicator`
111-
**Contained style** | `Widget.Material3.LoadingIndicator.Contained`
112-
113-
Default theme attribute: `?attr/loadingIndicatorStyle`
114-
115-
See the full list of
116-
[styles](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/res/values/styles.xml)
117-
and
118-
[attributes](https://github.com/material-components/material-components-android/tree/master/lib/java/com/google/android/material/loadingindicator/res/values/attrs.xml).
525 KB
Loading
2.93 MB
Loading

0 commit comments

Comments
 (0)