A sidebar component for React
React Sidebar is a sidebar component for React 0.14+. It offers the following features:
The touch interaction of the React Sidebar mimics the interactions that are supported by Android apps that implement the material design spec:
onSetOpen prop if the distance the sidebar was dragged is more than the dragToggleDistance prop.Note: The sidebar touch functionality doesn't work on IOS because of the "swipe-to-go-back" feature. Therefore the functionality has been disabled on IOS.
npm install react-sidebar
If you use TypeScript, typings are available on DefinitelyTyped and can be installed with:
npm install @types/react-sidebar
By design, React Sidebar does not keep track of whether it is open or not. This has to be done by the parent component. This allows the parent component to make changes to the sidebar and main content based on the open/docked state. An example could be to hide the "show menu" button from the main content when the sidebar is docked.
Because React Sidebar can be toggled by dragging the sidebar into its open/closed position, you will have to pass in an onSetOpen method as a prop to allow the sidebar to control the open state in the parent.
The minimum React component to integrate React Sidebar looks like this:
…
A common use case for a sidebar is to show it automatically when there is enough screen width available. This can be achieved using media queries via window.matchMedia. This again has to be integrated into the parent component so you can use the information to make changes to the sidebar and main content.
…
Styles are passed as an object with 5 keys, root, sidebar, content, overlay and dragHandle, and merged to the following defaults:
…
My goal was to make a React Component that implements the material design spec for navigation drawers. My initial attempt was to improve hamburger-basement by arnemart but I quickly figured that I better start from scratch. Still, that project helped me a ton to get started.
Cannot click the other elements
Keep Sidebar Content fixed
Failed prop type: The prop children is marked as required in Sidebar
How to use with children that use flexbox (required by react-native)
No label for version 3.0.2
Can't render sidebar inside my split pane windows properly
Feature Request: Add Custom Event on Overlay
bug when press the TAB key
Styling Scrollbar
React scroll