Drawer

Sheet, który można zsunąć gestem: panel od dołu lub z dowolnej krawędzi z uchwytem, zamykaniem przesunięciem i opcjonalnymi punktami zatrzymania, z pułapką fokusu, klawiszem Escape i przyciemnionym tłem z komponentu Sheet.

Dostępny w
  • Angular: dostępny
  • Vue: dostępny
  • React: dostępny
  • React Native: dostępny

Użycie

Import

ts
import {
  SoneDrawerComponent,
} from "@surface-one/angular/drawer";

Dokumentacja API

SoneDrawerComponentKomponent

`sone-drawer` — a sheet you can swipe away (shadcn/ui Drawer on Vaul, spartan/ui Sheet): a modal panel from the `bottom` (or another `side`) with a drag handle. It is the sheet's overlay — focus moves in and is trapped, Escape and the scrim dismiss it, focus returns to the opener, `[(open)]` or `@if` + `(dismiss)` show it — plus a pointer swipe toward its edge that dismisses it past a quarter of its size or on a flick. `snapPoints` (visible fractions of the drawer, ascending, e.g. `[0.5, 1]`) let it rest part-open, two-way as `[(activeSnapPoint)]`; the handle cycles them and keyboard focus inside opens it fully. Under reduced motion it moves without animating. Use the `soneDrawerHeader` / `soneDrawerTitle` / `soneDrawerDescription` / `soneDrawerFooter` / `soneDrawerClose` parts (`SONE_DIALOG_PARTS`).

Selektor
sone-drawer
Wejścia
NazwaTyp Domyślnie
opendwukierunkowe

Shown or not, two-way: `[(open)]`. Leave it unbound to show the overlay while it is mounted (render it with `@if` and close it on `(dismiss)`).

boolean | undefinedundefined
dismissiblebooleantrue
closeLabel—$localize`:verb|Closes a dialog or sheet:Close`
ariaLabelstring | nullnull
sideDrawerSide"bottom"
scrimClosesbooleantrue
showClose

The corner close button (off: a drawer closes by swipe, Escape, the scrim or a `soneDrawerClose`).

booleanfalse
handle

The drag handle at the inner edge (shown for `bottom` and `top`).

booleantrue
snapPoints

Visible fractions it rests at, ascending (e.g. `[0.5, 1]`); empty: open or dismissed.

readonly number[][]
activeSnapPointdwukierunkowe

The snap point it rests at, two-way: `[(activeSnapPoint)]` (default: the first).

number | nullnull
Wyjścia
NazwaTyp
dismissvoid