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

reboron

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

reboron

A collection of dialog animations with React.js

  • 0.4.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
197
decreased by-25.38%
Maintainers
1
Weekly downloads
 
Created
Source

Reboron

A collection of dialog animations with React.js.

  • Demo - https://jerairrest.github.io/reboron/

About

This is a fork of http://yuanyan.github.io/boron/ that has fixes for the deprecation warnings in React 15.*. I will be working on updating this package to use es6 as well as fixing some of the issues in the main package. PRs welcome!

Installation

The easiest way to use reboron is to install it from NPM and include it in your own React build process

npm install reboron --save

Usage

import React, { Component } from 'react';
import Modal from 'reboron/DropModal';

class Example extends Component {
  constructor(props) {
    super(props);
  }

  showModal() {
    this.refs.modal.show();
  }

  hideModal() {
    this.refs.modal.hide();
  }

  callback(evt) {
    console.log(evt);
  }

  render() {
    return (
      <div>
        <button onClick={ () => this.showModal() }>Open</button>
        <Modal ref={ 'modal' } keyboard={ () => this.callback() }>
          <h2>I am a dialog</h2>
          <button onClick={ () => this.hideModal() }>Close</button>
        </Modal>
      </div>
    );
  }
}

export default Example;

Props

  • className - Add custom class name.
  • keyboard - Receive a callback function or a boolean to choose to close the modal when escape key is pressed.
  • backdrop - Includes a backdrop element.
  • closeOnClick - Close the backdrop element when clicked.
  • duration - duration in milliseconds before the modal is hidden
  • onShow - Show callback.
  • onHide - Hide callback. Argument is the source of the hide action, one of:
    • hide - hide() method is the cause of the hide.
    • toggle - toggle() method is the cause of the hide
    • keyboard - keyboard (escape key) is the cause of the hide
    • backdrop - backdrop click is the cause of the hide
    • timeout - timeout is the cause of the hide
    • [any] - custom argument passed by invoking code into the hide() method when called directly.
  • modalStyle - CSS styles to apply to the modal
  • backdropStyle - CSS styles to apply to the backdrop
  • contentStyle - CSS styles to apply to the modal's content
  • rectStyle - CSS styles to apply to the modal's rectangle (OutlineModal only)

Note: If the hide() method is called directly, a custom source string can be passed as the argument, as noted above. For example, this might be useful if if multiple actions could cause the hide and it was desirable to know which of those actions was the trigger for the given onHide callback).

Custom Styles

Objects consisting of CSS properties/values can be passed as props to the Modal component. The values for the CSS properties will either add new properties or override the default property value set for that Modal type.

Modal with 80% width:

import React, { Component } from 'react';
import Modal from 'reboron/ScaleModal';

// Style object
const modalStyle = {
  width: '80%',
};

class Example extends Component {
  showModal() {
    this.refs.modal.show();
  }

  hideModal() {
      this.refs.modal.hide();
  }

  render() {
    return (
      <div>
        <button onClick={ () => this.showModal() }>Open</button>
        <Modal ref={ 'modal' } modalStyle={ modalStyle }>
          <h2>I am a dialog</h2>
          <button onClick={ () => this.hideModal() }>Close</button>
        </Modal>
      </div>
    );
  }
}

export default Example;

Red backdrop with a blue modal, rotated at 45 degrees:

import React, { Component } from 'react';
import Modal from 'reboron/FlyModal';

// Individual styles for the modal, modal content, and backdrop
const modalStyle = {
  transform: 'rotate(45deg) translateX(-50%)',
};

const backdropStyle = {
  backgroundColor: 'red',
};

const contentStyle = {
  backgroundColor: 'blue',
  height: '100%',
};

class Example extends Component {
  showModal() {
    this.refs.modal.show();
  }

  hideModal() {
    this.refs.modal.hide();
  }

  render() {
    return (
      <div>
        <button onClick={ () => this.showModal() }>Open</button>
        <Modal ref={ 'modal' } modalStyle={ modalStyle } backdropStyle={ backdropStyle } contentStyle={ contentStyle }>
          <h2>I am a dialog</h2>
          <button onClick={ () => this.hideModal() }>Close</button>
        </Modal>
      </div>
    );
  }
}

export default Example;

Modals

  • DropModal
  • FadeModal
  • FlyModal
  • OutlineModal
  • ScaleModal
  • WaveModal

License

Reboron is MIT licensed.

Keywords

FAQs

Package last updated on 29 Apr 2018

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