Android — Material 3
JS behaviour
Bottom sheet
Material’s modal bottom sheet with a drag handle: flick or tap the scrim to dismiss, it reads your finger’s velocity and settles with a spring; the body carries a real action list.
Real scenarios
The component as it is used in a product — not a specimen grid.
A sheet you can throw away
Open a track’s sheet, grab the handle and drag — release slowly and it snaps back, flick downward and it flies away. Tapping the scrim or pressing Escape closes it too.
My library
۴ قطعهVelocity above 0.5 px/ms dismisses even from mid-drag — Material’s own threshold.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| drag-handle | bar | '32 × 4' | A 32×4px handle above the sheet; it is a drag target itself. |
| velocity | px/s | '≈ 500' | A fast downward flick closes the sheet even from half way. |
| scrim | color | '#000 32%' | The sheet’s scrim at Material’s 32% black with a soft fade. |
Snippet
<dialog class="m3sheet">
<span class="m3sheet-handle"></span>
<button class="m3sheet-action">اشتراکگذاری</button>
<button class="m3sheet-action">دانلود آفلاین</button>
</dialog>
<style>
.m3sheet { margin: auto 0 0; border-radius: 28px 28px 0 0; padding: 12px 24px 24px;
background: #F7F2FA; }
.m3sheet-handle { display: block; inline-size: 32px; block-size: 4px; margin: 0 auto 12px;
border-radius: 999px; background: #CAC4D0; }
.m3sheet[open] { animation: m3sheet-in .35s cubic-bezier(.05,.7,.1,1); }
</style>