Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-bottom-drawer

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-bottom-drawer

A React Component to build friendly dialogs that slide from the bottom

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9K
decreased by-29.08%
Maintainers
1
Weekly downloads
 
Created
Source

React Bottom Drawer

This package contains a single React component that allows you to build mobile-friendly dialogs that slide from the bottom.

While it works on desktop, it is designed as a mobile interaction.

It has 100% typescript support, as it's written in typescript.

Usage

Using it is pretty straight-forward, just import the component, and place the content as it's children.

import React from "react";
import Drawer from "react-bottom-drawer";

function DemoDrawer() {
  const [isVisible, setIsVisible] = React.useState(false);

  const onClose = React.useCallback(() => {
    setIsVisible(false);
  }, []);

  return (
    <Drawer
      isVisible={isVisible}
      onClose={onClose}
    >
      { ... }
    </Drawer>
  )
}

Props

PropTypeRequired?Default ValueDescription
isVisiblebooleanRequired-Shows or hides the modal
onClosefunctionRequired-Invoked when the drawer should be close. You shoud be setting isVisible to false in this callback
mountOnEnterbooleanOptionaltrueIf true, the children won't be mounted until isVisible is true. If false, we will mount the children, and hide them via CSS.
unmountOnExitbooleanOptionaltrueIf true, we will unmount the children once isVisible goes back to false. If false, we won't unmount the children after mounting them.
durationnumberOptional250Duration of the enter / exit animation in ms
hideScrollbarsbooleanOptionalfalseIf true, scrollbars won't appear even if content is scrollable
classNamestringOptionalundefinedFor theming. If provided, it will generate classNames for all divs based on the provided value

Examples

Click here to see some examples on codesandbox.

Theming

You can provide custom styles by providing a custom className prop. You can use them to add styling to the drawer. If you need to override some values, you probably need to use !important.

These are all the available classNames:


.drawer {

}

.drawer__backdrop {

}

.drawer__handle-wrapper {

}

.drawer__handle {

}

.drawer__content {

}

Keywords

FAQs

Package last updated on 07 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc