react-drag-bottom-sheet
v1.0.15
Published
```sh npm i react-drag-bottom-sheet ``` [Live Demo](https://codesandbox.io/p/sandbox/react-drag-bottom-sheet-d37d2h?file=%2Fpackage.json%3A11%2C41&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522directi
Downloads
19
Maintainers
Readme
Installation
npm i react-drag-bottom-sheet
Props
| Props | Description | | ------ |-----------------------------------------------------------| | children | Content displayed under the bottom sheet. | | isOpen | Specifies if the bottom sheet is open by default. | | shouldCloseOnOverlayClick | Closes the bottom sheet when clicking on the overlay. | | shouldCloseOnEsc | Closes the bottom sheet when pressing the escape key. | | overlayClassName | Adds a class name to the overlay. | | onAfterClose| Callback function executed after the bottom sheet closes. | | className | Adds a class name to the bottom sheet's parent element. | | maxHeight | Default maxHeight 50% |
Example
import React, { useRef } from 'react';
import ReactDragBottomSheet from "react-drag-bottom-sheet";
const App = () => {
const ref = useRef(null)
const open = () => {
if(ref?.current) {
ref?.current?.open()
}
};
return (
<div className="App">
<button onClick={open} className="open-button">
Open Bottom Sheet
</button>
<ReactDragBottomSheet ref={ref}>
<>
<p> Bottom sheet children</p>
</>
</ReactDragBottomSheet>
</div>
);
};
export default App;