Skip to content

Commit 07354f9

Browse files
afohrmanleticiarossi
authored andcommitted
[Adaptive][Side Sheet][Docs] Added coplanar side sheet documentation.
PiperOrigin-RevId: 494731326
1 parent 2e9b39f commit 07354f9

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

docs/components/SideSheet.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ See [Bottom Sheet documentation](BottomSheet.md) for documentation about
2020
* [Using side sheets](#using-side-sheets)
2121
* [Standard side sheet](#standard-side-sheet)
2222
* [Modal side sheet](#modal-side-sheet)
23+
* [Coplanar side sheet](#coplanar-side-sheet)
2324
* [Anatomy and key properties](#anatomy-and-key-properties)
2425
* [Theming](#theming-side-sheets)
2526

@@ -211,6 +212,37 @@ You can then show the side sheet with `sideSheetDialog.show()` and dismiss it
211212
with `sideSheetDialog.hide()`. `SideSheetDialog` has built in functionality to
212213
automatically cancel the dialog after it is swiped off the screen.
213214

215+
## Coplanar side sheet
216+
217+
Coplanar side sheets are standard side sheets that "squash" a sibling view's
218+
content as the side sheet expands. Coplanar side sheets are on the same plane as
219+
their sibling, as opposed to standard side sheets, which are displayed above the
220+
screen content.
221+
222+
Note: Coplanar side sheets are not recommended for narrow screens.
223+
224+
### Coplanar side sheet example
225+
226+
To add a coplanar side sheet to your app, follow the steps to [add a standard
227+
side sheet to your layout](#standard-side-sheet-example), above, and simply set
228+
`app:coplanarSiblingViewId` on the `View` that has the side sheet
229+
`layout_behavior` set on it. You can point the coplanar sibling view id to any
230+
child of the `CoordinatorLayout`. Make sure to set
231+
`style="@style/Widget.Material3.SideSheet"` on your side sheet view, as well.
232+
233+
Alternatively, you can set the coplanar sibling view programmatically:
234+
235+
```kt
236+
coplanarSideSheet.setCoplanarSiblingView(coplanarSiblingView)
237+
```
238+
239+
To remove coplanar functionality from a side sheet, simply set the coplanar
240+
sibling view to `null`:
241+
242+
```kt
243+
coplanarSideSheet.setCoplanarSiblingView(null)
244+
```
245+
214246
## Anatomy and key properties
215247

216248
Side sheets have a sheet, content, and, if modal, a scrim.
@@ -221,13 +253,14 @@ Side sheets have a sheet, content, and, if modal, a scrim.
221253

222254
### Sheet attributes
223255

224-
Element | Attribute | Related method(s) | Default value
225-
-------------- | --------------------- | --------------------------------- | -------------
226-
**Color** | `app:backgroundTint` | N/A | `?attr/colorSurface`
227-
**Shape** | `app:shapeAppearance` | N/A | `?attr/shapeAppearanceLargeComponent`
228-
**Elevation** | `android:elevation` | N/A | 0dp
229-
**Max width** | `android:maxWidth` | `setMaxWidth`<br/>`getMaxWidth` | N/A
230-
**Max height** | `android:maxHeight` | `setMaxHeight`<br/>`getMaxHeight` | N/A
256+
Element | Attribute | Related method(s) | Default value
257+
-------------- |-----------------------------|---------------------------------------------------------| -------------
258+
**Color** | `app:backgroundTint` | N/A | `?attr/colorSurface`
259+
**Coplanar sibling view id** | `app:coplanarSiblingViewId` | `setCoplanarSiblingViewId`<br/>`setCoplanarSiblingView` | N/A
260+
**Shape** | `app:shapeAppearance` | N/A | `?attr/shapeAppearanceLargeComponent`
261+
**Elevation** | `android:elevation` | N/A | 0dp
262+
**Max width** | `android:maxWidth` | `setMaxWidth`<br/>`getMaxWidth` | N/A
263+
**Max height** | `android:maxHeight` | `setMaxHeight`<br/>`getMaxHeight` | N/A
231264

232265
### Behavior attributes
233266

0 commit comments

Comments
 (0)