React Modern Drawer is a lightweight and performant component library for creating highly customizable slide-out drawers in React applications. Currently at version 1.4.0, it offers a simple API to integrate responsive drawers for navigation, settings, or auxiliary content. The project maintains an active development pace, with recent updates focused on type improvements and build process fixes. Key differentiators include its small bundle size, excellent performance across various browsers, and ease of use, making it a strong candidate for projects prioritizing efficiency and developer experience without relying on larger UI frameworks. It provides fine-grained control over drawer direction, size, and overlay behavior.
npm install react-modern-drawerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate and control a modern drawer component in a React application using hooks for state management. It shows how to toggle the drawer, set its direction and size, and apply custom CSS classes.
Ensure you add `import 'react-modern-drawer/dist/index.css';` to your root component or an appropriate entry point in your application.
Change named imports to default imports: `import Drawer from 'react-modern-drawer';`
Review your TypeScript code for any type errors related to `DrawerProps` or other exported types after upgrading and adjust accordingly.
Add `import 'react-modern-drawer/dist/index.css';` to your main application file (e.g., `App.tsx` or `index.tsx`).
Change the import statement from `import { Drawer } from 'react-modern-drawer';` to `import Drawer from 'react-modern-drawer';`.Ensure all hook calls are within the body of a functional React component and that your installed React version meets the `>=16.0.0` peer dependency requirement.