Skip to content

Commit 2b29a26

Browse files
Material Design Teamdrchen
authored andcommitted
[Docs] Updated docs with Expressive code/info.
PiperOrigin-RevId: 798982415
1 parent 659e3bc commit 2b29a26

File tree

60 files changed

+405
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+405
-51
lines changed

docs/components/Chip.md

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ represent an input, attribute, or action. Chips help people enter information,
1414
make selections, filter content, or trigger actions. There are four variants of
1515
chips.
1616

17-
![Examples of the four different chip types](assets/chips/chip_types.png)
17+
![Examples of the four different chip types](assets/chips/chip-types.png)
1818

1919
1. Assist chip
2020
2. Filter chip
@@ -34,7 +34,7 @@ chips.
3434

3535
<summary><h4>Assist</h4></summary>
3636

37-
![Anatomy of assist chip](assets/chips/assist_anatomy.png)
37+
![Anatomy of assist chip](assets/chips/assist-anatomy.png)
3838

3939
1. Container
4040
2. Label text
@@ -45,7 +45,7 @@ chips.
4545

4646
<summary><h4>Filter</h4></summary>
4747

48-
![Anatomy of a filter chip](assets/chips/filter_anatomy.png)
48+
![Anatomy of a filter chip](assets/chips/filter-anatomy.png)
4949

5050
1. Container
5151
2. Label text
@@ -57,7 +57,7 @@ chips.
5757

5858
<summary><h4>Input</h4></summary>
5959

60-
![Anatomy of a input chip](assets/chips/input_anatomy.png)
60+
![Anatomy of a input chip](assets/chips/input-anatomy.png)
6161

6262
1. Container
6363
2. Label text
@@ -69,7 +69,7 @@ chips.
6969

7070
<summary><h4>Suggestion</h4></summary>
7171

72-
![Anatomy of a suggestion chip](assets/chips/suggestion_anatomy.png)
72+
![Anatomy of a suggestion chip](assets/chips/suggestion-anatomy.png)
7373

7474
1. Container
7575
2. Label text
@@ -184,12 +184,12 @@ Assist chips represent smart or automated actions that can span multiple apps,
184184
such as opening a calendar event from the home screen. Assist chips function as
185185
though the user asked an assistant to complete the action.
186186

187-
#### Assist chip example
187+
#### Default
188188

189189
The following example shows an activated assist chip.
190190

191191
!["A selected action chip with its corresponding action, a visible popup textbox
192-
stating the chip has been activated."](assets/chips/chips_selected_assist.png)
192+
stating the chip has been activated."](assets/chips/chips-selected-assist.png)
193193

194194
In the layout:
195195

@@ -203,14 +203,31 @@ In the layout:
203203

204204
<com.google.android.material.chip.Chip
205205
android:id="@+id/chip_1"
206-
style="@style/Widget.Material3.Chip.Assist"
207206
android:layout_width="wrap_content"
208207
android:layout_height="wrap_content"
209208
android:text="@string/chip_text_1"
210209
app:chipIcon="@drawable/circle_1"
211210
app:ensureMinTouchTargetSize="true"/>
212211
```
213212

213+
#### Elevated
214+
215+
!["Assist elevated chip in light theme"](assets/chips/chip-assist-elevated-light-theme.png)
216+
217+
!["Assist elevated chip in dark theme"](assets/chips/chip-assist-elevated-dark-theme.png)
218+
219+
Assist chips also come in an `Elevated` style variant, to be used when placed
220+
against a background that needs protection, such as an image.
221+
222+
```xml
223+
<com.google.android.material.chip.Chip
224+
style="@style/Widget.Material3.Chip.Assist.Elevated"
225+
android:layout_width="wrap_content"
226+
android:layout_height="wrap_content"
227+
android:text="@string/chip_text"
228+
app:chipIcon="@drawable/ic_action_24"/>
229+
```
230+
214231
</details>
215232

216233
<details>
@@ -222,12 +239,12 @@ Filter chips use tags or descriptive words to filter content.
222239
Filter chips clearly delineate and display options in a compact area. They are a
223240
good alternative to toggle buttons or checkboxes.
224241

225-
#### Filter chip example
242+
#### Default
226243

227244
The following example shows filter chips.
228245

229246
!["6 white "Filter" chips spread across 2 lines: "Filters" 1 and 3 selected and
230-
are light purple and include checkmarks."](assets/chips/chips_filter.png)
247+
are light purple and include checkmarks."](assets/chips/chips-filter.png)
231248

232249
In the layout:
233250

@@ -271,6 +288,23 @@ In the layout:
271288
</com.google.android.material.chip.ChipGroup>
272289
```
273290

291+
#### Elevated
292+
293+
!["Filter elevated chip in light theme"](assets/chips/chip-filter-elevated-light-theme.png)
294+
295+
!["Filter elevated chip in dark theme"](assets/chips/chip-filter-elevated-dark-theme.png)
296+
297+
Filter chips also come in an `Elevated` style variant, to be used when placed
298+
against a background that needs protection, such as an image.
299+
300+
```xml
301+
<com.google.android.material.chip.Chip
302+
style="@style/Widget.Material3.Chip.Filter.Elevated"
303+
android:layout_width="wrap_content"
304+
android:layout_height="wrap_content"
305+
android:text="@string/chip_text" />
306+
```
307+
274308
</details>
275309

276310
<details>
@@ -285,7 +319,7 @@ that input by converting text into chips.
285319

286320
The following example shows input chips.
287321

288-
!["Input chips with texts Input 1 to 6."](assets/chips/chips_input.png)
322+
!["Input chips with texts Input 1 to 6."](assets/chips/chips-input.png)
289323

290324
In the layout:
291325

@@ -294,19 +328,19 @@ In the layout:
294328
...>
295329
<com.google.android.material.chip.Chip
296330
android:id="@+id/chip_1"
297-
style="@style/Widget.Material3.Chip.Input"
331+
style="?attr/chipStandaloneStyle"
298332
android:layout_width="wrap_content"
299333
android:layout_height="wrap_content"
300334
android:text="@string/text_input_1"/>
301335

302336
<com.google.android.material.chip.Chip
303337
...
304-
style="@style/Widget.Material3.Chip.Input"
338+
style="?attr/chipStandaloneStyle"
305339
android:text="@string/text_input_2"/>
306340

307341
<com.google.android.material.chip.Chip
308342
...
309-
style="@style/Widget.Material3.Chip.Input"
343+
style="?attr/chipStandaloneStyle"
310344
android:text="@string/text_input_3"/>
311345

312346
</com.google.android.material.chip.ChipGroup>
@@ -321,14 +355,14 @@ In the layout:
321355
Suggestion chips help narrow a user’s intent by presenting dynamically generated
322356
suggestions, such as offering possible responses or providing search filters.
323357

324-
#### Suggestion chip example
325-
326-
The following example shows suggestion chips.
358+
The following example shows suggestion chips in default and elevated styles.
327359

328360
!["3 suggestion chips, where suggestion 1 is unselected with a solid border and
329361
white background, suggestion 2 is selected with no border and a light purple
330362
background, and suggestion 3 is an unselected elevated suggestion with no border
331-
and a light grey background."](assets/chips/chips_suggestion.png)
363+
and a light grey background."](assets/chips/chips-suggestion.png)
364+
365+
#### Default
332366

333367
In the layout:
334368

@@ -344,14 +378,26 @@ In the layout:
344378
...
345379
style="@style/Widget.Material3.Chip.Suggestion"
346380
android:text="@string/chip_text_2"/>
347-
<com.google.android.material.chip.Chip
348-
...
349-
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
350-
android:text="@string/chip_text_3"/>
351381

352382
</com.google.android.material.chip.ChipGroup>
353383
```
354384

385+
#### Elevated
386+
387+
Suggestion chips also come in an `Elevated` style variant. These chips
388+
should be used when placed against a background that needs protection, such
389+
as an image.
390+
391+
```xml
392+
<com.google.android.material.chip.Chip
393+
style="@style/Widget.Material3.Chip.Suggestion.Elevated"
394+
android:layout_width="wrap_content"
395+
android:layout_height="wrap_content"
396+
android:text="@string/chip_text_3" />
397+
```
398+
399+
**Note:** Suggestion chips are usually placed within a `ChipGroup`.
400+
355401
</details>
356402

357403
## Code implementation
@@ -448,7 +494,7 @@ opposed to a `ViewGroup` such as `RecyclerView`. A `ChipGroup` contains a set of
448494
A `ChipGroup` rearranges chips across multiple rows by default.
449495

450496
!["6 white "Filter" chips spread across 2 lines: "Filters" 1 and 3 selected and
451-
are light purple and include checkmarks."](assets/chips/chips_filter.png)
497+
are light purple and include checkmarks."](assets/chips/chips-filter.png)
452498

453499
```xml
454500
<com.google.android.material.chip.ChipGroup
@@ -466,7 +512,7 @@ A `ChipGroup` can also constrain its chips to a single row using the
466512
`ChipGroup` with a `HorizontalScrollView`.
467513

468514
!["Single line of white chips: chips 1, 2, and 3 are fully visible, chip 4 is
469-
partly visible"](assets/chips/chips_singleline.png)
515+
partly visible"](assets/chips/chips-singleline.png)
470516

471517
```xml
472518
<HorizontalScrollView
@@ -497,7 +543,7 @@ for lower amounts.
497543
The following image shows a group of chips with
498544
`app:chipSpacingHorizontal="42dp"`.
499545

500-
!["6 white chips in 2 rows with 42dp horizontal spacing"](assets/chips/chips_spacing.png)
546+
!["6 white chips in 2 rows with 42dp horizontal spacing"](assets/chips/chips-spacing.png)
501547

502548
</details>
503549

@@ -563,7 +609,7 @@ For example, consider an editable e-mail address field that converts addresses
563609
to chips as they are typed and validated. We can combine `ChipDrawable` with
564610
spans to add a chip to an `EditText`:
565611

566-
!["Standalone chip inside a text field"](assets/chips/chips_standalone.png)
612+
!["Standalone chip inside a text field"](assets/chips/chips-standalone.png)
567613

568614
```kt
569615
chip.setBounds(0, 0, chip.intrinsicWidth, chip.intrinsicHeight)
@@ -594,7 +640,7 @@ API and source code:
594640

595641
The following example shows chips with Material theming.
596642

597-
!["3 chips with brown text and icons, white fill, and pink outlines"](assets/chips/chips_theming.png)
643+
!["3 chips with brown text and icons, white fill, and pink outlines"](assets/chips/chips-theming.png)
598644

599645
##### Implementing chip theming
600646

docs/components/NavigationRail.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ path: /catalog/navigation-rail/
1313
lets people switch between UI views on mid-sized devices. There are two types of
1414
navigation rail.
1515

16-
<img src="assets/navigationrail/navigation_rail_hero.png" alt="The navigation rail container is 80 dp wide by default." height="400"/>
16+
<img src="assets/navigationrail/navigation-rail-hero.png" alt="The navigation rail container is 80 dp wide by default." height="400"/>
1717

1818
1. Collapsed navigation rail
1919
2. Expanded navigation rail
@@ -27,7 +27,7 @@ navigation rail.
2727

2828
## Anatomy
2929

30-
<img src="assets/navigationrail/navigation_rail_anatomy.png" alt="Navigation rail anatomy diagram">
30+
<img src="assets/navigationrail/navigation-rail-anatomy.png" alt="Navigation rail anatomy diagram">
3131
Collapsed and expanded navigation rail elements:
3232

3333
1. Container
@@ -43,12 +43,14 @@ Collapsed and expanded navigation rail elements:
4343
More details on anatomy items in the
4444
[component guidelines](https://m3.material.io/components/navigation-rail/guidelines#b51e4558-351f-4368-af8d-bbf1f63f68b4).
4545

46-
## M3 Expressive update
46+
## M3 Expressive
47+
48+
### M3 Expressive update
4749

4850
Before you can use `Material3Expressive` component styles, follow the
4951
[`Material3Expressive` themes setup instructions](https://github.com/material-components/material-components-android/tree/master/docs/getting-started.md#material3expressive-themes).
5052

51-
<img src="assets/navigationrail/navigation_rail_expressive.png" alt="collapsed and expanded navigation rails" width="500">
53+
<img src="assets/navigationrail/navigation-rail-expressive.png" alt="collapsed and expanded navigation rails" width="500">
5254
The collapsed and expanded navigation rails match visually and can transition
5355
into each other
5456

@@ -79,6 +81,28 @@ The expanded nav rail is meant to replace the navigation drawer.
7981
* Active label on vertical items changed from **on surface variant** to
8082
**secondary**
8183

84+
### M3 Expressive styles
85+
86+
Measurement changes from M3:
87+
88+
* Width: from 80dp to 96dp
89+
* Color: new expressive colors!
90+
* Item minimum height: from 60dp to 64dp
91+
* Item spacing: from 0dp to 4dp
92+
* Elevation: from 0dp to 3dp
93+
* Top item padding: from 4dp to 6dp
94+
* Bottom item padding: from 12dp to 4dp
95+
* Top margin of navigation rail content: from 8dp to 44dp
96+
* Padding between optional header view and navigation rail items: from 8dp to
97+
40dp
98+
* Label text is no longer bolded when selected
99+
100+
The default style for navigation rail is:
101+
102+
```xml
103+
<item name="navigationRailStyle">@style/Widget.Material3Expressive.NavigationRailView</item>
104+
```
105+
82106
## Key properties
83107

84108
### Container attributes
@@ -319,7 +343,7 @@ navigationRail.setOnNavigationItemReselectedListener { item ->
319343

320344
Which results in:
321345

322-
![The navigation rail container is 72 dp wide by default.](assets/navigationrail/navigation_rail_demo.png)
346+
![The navigation rail container is 72 dp wide by default.](assets/navigationrail/navigation-rail-demo.png)
323347

324348
By default, navigation rail adds top and bottom padding according to top and
325349
bottom window insets—helping the header layout and menu items dodge system
@@ -336,7 +360,7 @@ bottom insets independently by using `app:paddingTopSystemWindowInsets` and
336360

337361
The following example shows a navigation rail with four icons.
338362

339-
<img src="assets/navigationrail/navigation_rail_example.png" alt="Example navigation rail with four icons" height="500"/>
363+
<img src="assets/navigationrail/navigation-rail-example.png" alt="Example navigation rail with four icons" height="500"/>
340364

341365
* Alarms
342366
* Schedule
@@ -425,7 +449,7 @@ off' as it could result in a strange animation due to the `Transition`.
425449

426450
Collapsed navigation rail <div style="width:420px"></div> | Expanded navigation rail <div style="width:420px"></div>
427451
:----------------------------------------------------------------------------------------------------: | :------------------------------------------------------:
428-
<img src="assets/navigationrail/collapsed_nav_rail.png" alt="Collapsed navigation rail" height="560"/> | <img src="assets/navigationrail/expanded_nav_rail.png" alt="Expanded navigation rail" height="560"/>
452+
<img src="assets/navigationrail/collapsed-nav-rail.png" alt="Collapsed navigation rail" height="560"/> | <img src="assets/navigationrail/expanded-nav-rail.png" alt="Expanded navigation rail" height="560"/>
429453

430454
</details>
431455

@@ -436,7 +460,7 @@ Rail icons can include badges on the upper right corner of the icon. Badges
436460
convey dynamic information about the associated destination, such as counts or
437461
status.
438462

439-
![Navigation rail with badges](assets/navigationrail/navigation_rail_badges.png)
463+
![Navigation rail with badges](assets/navigationrail/navigation-rail-badges.png)
440464

441465
Initialize and show a `BadgeDrawable` associated with `menuItemId`. Subsequent
442466
calls to this method will reuse the existing `BadgeDrawable`:
@@ -476,7 +500,7 @@ The rail provides a convenient container for anchoring a header view, such as a
476500
`FloatingActionButton` or a logo, to the top of the rail, using the
477501
`app:headerLayout` attribute.
478502

479-
<img src="assets/navigationrail/navigation_rail_fab.png" alt="Navigation rail with a FAB in the header" height="550"/>
503+
<img src="assets/navigationrail/navigation-rail-fab.png" alt="Navigation rail with a FAB in the header" height="550"/>
480504

481505
```xml
482506
<com.google.android.material.navigationrail.NavigationRailView
@@ -520,7 +544,7 @@ API and source code:
520544

521545
The following example shows a navigation rail with Material theming.
522546

523-
![Navigation rail theming example](assets/navigationrail/navigation_rail_theming.png)
547+
![Navigation rail theming example](assets/navigationrail/navigation-rail-theming.png)
524548

525549
##### Implementing navigation rail theming
526550

0 commit comments

Comments
 (0)