Socket
Book a DemoInstallSign in
Socket

react-modal-slider

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-modal-slider

I'm excited to introduce you react-modal-slider.

0.2.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

react-modal-slider

I'm excited to introduce you react-modal-slider.

  • This library based on the react-modal.
  • Open and close modal (animated) from right or left side

Demo on codesandbox

Install

  npm i react-modal-slider

Usage

import React from 'react';

import Modal from 'react-modal-slider';
import 'react-modal-slider/lib/main.css';

export default class Demo extends React.Component {
  state = {
    isOpen: false,
  };

  toggleVisibleModal = () => {
    this.setState({
      isOpen: !this.state.isOpen,
    });
  };

  renderCloseComponent = () => (
    <button onClick={this.toggleVisibleModal}>
      <img src={'/close.svg'} />
    </button>
  );

  render() {
    return (
      <div id={'demo'}>
        <button onClick={this.toggleVisibleModal}>Open modal</button>
        <Modal
          // default false
          isOpen={this.state.isOpen}
          // default 60%
          width={'40%'}
          // default from right
          directionFrom={'right'}
          // default Modal
          contentLabel={'Demo Modal'}
          onRequestClose={this.toggleVisibleModal}
          // optional for accessibility
          setAppElement={'#root'}
          // default false allows you to skip setAppElement prop for react-modal
          ariaHideApp={true}
          // allow you to set the maximum width of the viewport
          // at which the modal will be expanded to full screen
          maxMediaWidth={1024}
          // allows you to decorate a className or overlayClassName
          className={'string'}
          overlayClassName={'string'}
        >
          Demo content for Modal
          {this.renderCloseComponent()}
        </Modal>
      </div>
    );
  }
}

Keywords

react

FAQs

Package last updated on 18 Mar 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.