Genesis
@stable

Drawer

Mobile drawer (vaul-based).

packages/ui/src/components/ui/drawer.tsx

Import
Subpath export: @marktiderman/genesis-ui
import { Drawer } from "@marktiderman/genesis-ui";
Exports
Re-exported from @marktiderman/genesis-ui.
  • Drawer
  • DrawerTrigger
  • DrawerContent
  • DrawerHeader
  • DrawerTitle
  • DrawerDescription
  • DrawerFooter
Components
Auto-generated from TypeScript source via react-docgen-typescript.

Drawer

PropTypeDefaultDescription
activeSnapPointstring | number | null—
autoFocusboolean—
closeThresholdnumber0.25Number between 0 and 1 that determines when the drawer should be closed. Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.
containerHTMLElement | null—
defaultOpenbooleanfalseOpened by default, skips initial enter animation. Still reacts to `open` state changes
directionenum'bottom'Direction of the drawer. Can be `top` or `bottom`, `left`, `right`.
disablePreventScrollbooleanfalseWhen set to `true` prevents scrolling on the document body on mount, and restores it on unmount.
dismissiblebooleantrueWhen `false` dragging, clicking outside, pressing esc, etc. will not close the drawer. Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.
fixedboolean—When `true`, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open
handleOnlybooleanfalseWhen `true` only allows the drawer to be dragged by the `<Drawer.Handle />` component.
modalbooleantrueWhen `false` it allows to interact with elements outside of the drawer without closing it.
nestedboolean—
noBodyStylesboolean—When `true` the `body` doesn't get any styles assigned from Vaul
onAnimationEnd((open: boolean) => void)—Gets triggered after the open or close animation ends, it receives an `open` argument with the `open` state of the drawer by the time the function was triggered. Useful to revert any state changes for example.
onClose(() => void)—
onDrag((event: PointerEvent<HTMLDivElement>, percentageDragged: number) => void)—
onOpenChange((open: boolean) => void)—
onRelease((event: PointerEvent<HTMLDivElement>, open: boolean) => void)—
openboolean—
preventScrollRestorationboolean—
repositionInputsbooleantrue when {@link snapPoints } is definedWhen `true` Vaul will reposition inputs rather than scroll then into view if the keyboard is in the way. Setting it to `false` will fall back to the default browser behavior.
scrollLockTimeoutnumber500msDuration for which the drawer is not draggable after scrolling content inside of the drawer.
setActiveSnapPoint((snapPoint: string | number | null) => void)—
setBackgroundColorOnScalebooleantrueWhen `false` we don't change body's background color when the drawer is open.
shouldScaleBackgroundbooleantrue
snapToSequentialPointbooleanfalseDisabled velocity based swiping for snap points. This means that a snap point won't be skipped even if the velocity is high enough. Useful if each snap point in a drawer is equally important.

Portal

No declared props.

DrawerOverlay

PropTypeDefaultDescription
asChildboolean—

DrawerTrigger

PropTypeDefaultDescription
asChildboolean—

DrawerClose

PropTypeDefaultDescription
asChildboolean—

DrawerContent

PropTypeDefaultDescription
asChildboolean—

DrawerHeader

No declared props.

DrawerFooter

No declared props.

DrawerTitle

PropTypeDefaultDescription
asChildboolean—

DrawerDescription

PropTypeDefaultDescription
asChildboolean—