1.1.0 • Published 4 years ago

@jaw-dev/react-modal v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

@jawdev/react-modal

A simple React modal

Install

npm install --save @jaw-dev/react-modal

yarn add @jaw-dev/react-modal

Usage

import React, { Component } from 'react';

import Modal from 'jawdev-react-modal';

class Example extends Component {
  render() {
    return (
      <Modal>
        <ModalContentComponent />
      </Modal>
    );
  }
}

Options

OptionDescriptionTypedefault
labelThe text in the main modal buttonstring'Open'
delayBy defaul the modal opens/closes with a fade in/out. The delay id how long the fade in/out takesinteger200
contentYou can use a string for the modal content instead of an React componentstring''
svgpropsBy default the modal close icon is a SVG. This option will allow you to set the SVG attributes such as with and heightobject{}
modalCloseImageOverwrite the default Close Icon imagestringdefault svg
modalCloseLabelOverwrite the default Close Label (hidden for accesiblility be default)string'Close'
overlayCloseOnClickClose the modal on overlay clickbooleantrue
overlayCloseOnClickClose the modal on overlay clickbooleantrue
closeOnButtonClickClose the modal on close button clickbooleantrue
openOnLoadOpen the Modal on page loadbooleanfalse
showButtonShow the modal open buttonbooleantrue
showCloseButtonShow the modal close buttonbooleantrue

** Style Components is used for generating the CSS to allow for the use of CSS pseudo selectors. To overwrite a component's CSS, create a object with the CSS you want to overwrite.

const newModalCloseStyles = {
  top: '1rem',
  right: '1rem',
  padding: '1rem',
  backgroundColor: 'black',
  ':hover': {
    cursor: 'grab'
  }
};
1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago