react-bottom-drawer is a lightweight React component designed to create mobile-friendly dialogs that slide up from the bottom of the screen. Although functional on desktop, its primary design consideration is touch-based mobile interaction patterns, offering a UX similar to bottom sheets found in many mobile applications. Currently at version 0.1.1, the library provides a simple, controlled API for managing the drawer's visibility and content. It offers full TypeScript support, being entirely written in TypeScript, which enhances developer experience through strong typing and autocompletion. The component differentiates itself by focusing on a specific mobile UI pattern with minimal configuration, allowing developers to easily integrate bottom sheet UIs into their applications without extensive setup. Release cadence is not explicitly defined but is expected to evolve as the project matures and gathers community feedback, typical for pre-1.0 libraries, with potential breaking changes between minor versions as the API solidifies.
npm install react-bottom-drawerVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to integrate `react-bottom-drawer` into a functional React component, controlling its visibility with local state and providing content.
Review the changelog carefully when upgrading to new minor versions. Consider pinning to exact versions (e.g., `"react-bottom-drawer": "0.1.1"`) until a stable major release.
When custom styling via `className` doesn't apply, inspect the component's generated DOM to identify the specific class names and hierarchy. Use `!important` sparingly for direct overrides, or increase CSS specificity in your custom styles to match or exceed the component's defaults.
Ensure the `onClose` callback function provided to the `Drawer` component correctly updates the state variable bound to `isVisible` to `false` in your parent component (e.g., `setIsVisible(false)`).
If you need the drawer's children to retain their state or remain in the DOM even when the drawer is hidden (e.g., for faster re-opening or persistent state), set `mountOnEnter={false}` or `unmountOnExit={false}` as appropriate for your use case.Ensure `react` and `react-dom` (versions `^16.8.0` or higher) are installed and correctly configured in your project. Verify that the `Drawer` component is rendered within a proper React functional component.
Double-check that the `onClose` callback function in your parent component explicitly sets the `isVisible` state variable to `false`. For example, if you use `useState`, ensure `setIsVisible(false)` is called within `onClose`.