Skip to content


[Side Sheet][Docs] Add left sheet/sheet edge documentation.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 546308773
  • Loading branch information
afohrman authored and paulfthomas committed Jul 7, 2023
1 parent b0a1c0b commit d440e3c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/components/
Expand Up @@ -269,6 +269,7 @@ Element | Attribute | Related method(s)
**Color** | `app:backgroundTint` | N/A | `?attr/colorSurface`
**Coplanar sibling view id** | `app:coplanarSiblingViewId` | `setCoplanarSiblingViewId`<br/>`setCoplanarSiblingView` | N/A
**Shape** | `app:shapeAppearance` | N/A | `?attr/shapeAppearanceLargeComponent`
**Sheet edge** | `android:layout_gravity` | `setSheetEdge` (modal only) | end
**Elevation** | `android:elevation` | N/A | 0dp
**Max width** | `android:maxWidth` | `setMaxWidth`<br/>`getMaxWidth` | N/A
**Max height** | `android:maxHeight` | `setMaxHeight`<br/>`getMaxHeight` | N/A
Expand All @@ -282,6 +283,52 @@ Behavior | Related method(s)
------------------------------------------- | ------------------------------------------------------------------------- | -------------
`app:behavior_draggable` | `setDraggable`<br/>`isDraggable` | `true`

### Sheet edge
You can set the sheet to originate from the left or right side of the screen.
You can also automatically switch the sheet edge based on layout direction, by
setting the sheet edge to `start` or `end`.

#### Standard and Coplanar Sheets
To set a standard or coplanar sheet's edge, set the `gravity` property of the
side sheet `View`'s `CoordinatorLayout.LayoutParams`, then request a layout pass
on the side sheet `View`.

val layoutParams = sideSheetView.layoutParams
if (layoutParams is CoordinatorLayout.LayoutParams) {
layoutParams.gravity = sheetGravity

You can also set the sheet edge with XML, by setting `android:layout_gravity`
to the desired gravity:

<include layout="@layout/side_sheet_layout" />

#### Modal Sheets
To set a modal sheet's edge, pass a `Gravity` constant into `SideSheetDialog`'s
dedicated `setSheetEdge` method. For example, set the sheet edge to `start` like


Note: Runtime changes to sheet edges are not supported for modal sheets and may
not work as expected. If you'd like to change the sheet edge at runtime, you
should recreate the sheet, then call `setSheetEdge` with the new gravity.

### Styles

**Element** | **Value**
Expand Down

0 comments on commit d440e3c

Please sign in to comment.