API & PlaygroundReactUseBottomSheetReturnMethods

Methods

The useBottomSheet hook provides below methods to control the bottom sheet’s behavior.

  • open(): void
    Opens the bottom sheet.

  • close(): void
    Closes the bottom sheet.

  • setIsOpen(open: boolean): void
    Sets the open state of the bottom sheet. It comes in handy when you want to make a toggle button.

  • moveTo(endY: number): void
    Moves the bottom sheet to a specified vertical position within the viewport. The top of the viewport is 0, increasing towards the bottom.

  • snapTo(percent: number): void
    Moves the bottom sheet to a relative position within the viewport based on percentage. For example, 0.1 would position the bottom sheet 10% below the top of the viewport.

;