• Stars
    star
    1,481
  • Rank 31,741 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of dialog animations with React.js

Boron npm version

Pair on this

A collection of dialog animations with React.js.

  • React 0.14+ Use boron 0.2
  • React 0.12+ Use boron 0.1

Demo & Examples

Live demo: yuanyan.github.io/boron

To build the examples locally, run:

npm install
gulp dev

Then open localhost:9999 in a browser.

Installation

The easiest way to use boron is to install it from NPM and include it in your own React build process (using Browserify, etc).

You can also use the standalone build by including dist/boron.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install boron --save

Usage

var Modal = require('boron/DropModal');
var Example = React.createClass({
    showModal: function(){
        this.refs.modal.show();
    },
    hideModal: function(){
        this.refs.modal.hide();
    },

    callback: function(event){
        console.log(event);
    },

    render: function() {
        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>
        );
    }
});

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.
  • 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
  • [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

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:

var Modal = require('boron/ScaleModal');

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

var Example = React.createClass({
    showModal: function(){
        this.refs.modal.show();
    },
    hideModal: function(){
        this.refs.modal.hide();
    },
    render: function() {
        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>
        );
    }
});

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

var Modal = require('boron/FlyModal');

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

var backdropStyle = {
    backgroundColor: 'red'
};

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

var Example = React.createClass({
    showModal: function(){
        this.refs.modal.show();
    },
    hideModal: function(){
        this.refs.modal.hide();
    },
    render: function() {
        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>
        );
    }
});

Modals

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

Browser Support

IE Chrome Firefox Opera Safari
IE 10+ ✔ Chrome 4.0+ ✔ Firefox 16.0+ ✔ Opera 15.0+ ✔ Safari 4.0+ ✔

License

Boron is MIT licensed.

More Repositories

1

halogen

A collection of loading spinners with React.js
JavaScript
1,596
star
2

react-timesheet

Time Sheet Component for React
JavaScript
259
star
3

pragmatic-jquery

Pragmatic jQuery Style
111
star
4

react-ajax

Ajax Request Component for React.
JavaScript
108
star
5

node-optimage

Image optimizer, PNG, JPEG and GIFimage compress on OS X, Linux, FreeBSD and Windows
JavaScript
67
star
6

domkit

Toolkit for DOM
JavaScript
61
star
7

node-regexp

New RegExp Style for Node.js
JavaScript
59
star
8

ming

High-productivity JavaScript Solution
JavaScript
51
star
9

jsprofiler

javascript profiler
JavaScript
45
star
10

UglifyJS-java

JavaScript parser / mangler / compressor / beautifier library for for Java
JavaScript
42
star
11

react-native-web-example

React Native Web Example
JavaScript
40
star
12

react-image

Enhanced Image Component for React.
JavaScript
36
star
13

hp

HTTP Proxy Kit
JavaScript
33
star
14

react-mq

Media Query Component for React.
JavaScript
26
star
15

react-storage

Storage Component for React
JavaScript
25
star
16

know-your-chrome

know your chrome
C++
21
star
17

pre

An enjoyable css framework use less
JavaScript
19
star
18

node-webp-bin

WebP Node.js wrapper that makes it seamlessly available as a local dependency on OS X, Linux and Windows.
JavaScript
16
star
19

commons-json

A high performance JSON library for java
Java
13
star
20

barium

Pragmatic Styling with React.js
JavaScript
13
star
21

haste-resolver-webpack-plugin

Haste Resolver Webpack Plugin
JavaScript
12
star
22

react-signals

Signals Component for React.
JavaScript
11
star
23

react-pull

Pull Component for React
JavaScript
8
star
24

arsenic

Backgroud component for React
JavaScript
8
star
25

react-native-web-exploding-hearts

React Native Web Exploding Hearts Example
JavaScript
8
star
26

mobi

Framework for developing mobile only projects on the web.
JavaScript
7
star
27

google-cli

Google CLI.
JavaScript
7
star
28

requirejs-tmpl

Require.js plugin for templates, it's a tooling not a library
JavaScript
7
star
29

fanta

when function met fanta.
JavaScript
7
star
30

ship

Code manager client
JavaScript
5
star
31

morse

Morse Code Game (WIP)
JavaScript
4
star
32

universal-react-starter

A professional universal (isomorphic) react starter for building web apps.
JavaScript
4
star
33

less2

LESS 2.0
JavaScript
4
star
34

yuanyan.github.io

Website
JavaScript
4
star
35

ladybug

Making The Mobile Web Faster
JavaScript
3
star
36

jquery-sonar

jQuery sonar effect plugin
JavaScript
3
star
37

moon

js&css file server on top of nodejs
JavaScript
3
star
38

404

QQ Connect 404 Page
3
star
39

haste-resolver

Haste Resolver
JavaScript
3
star
40

jazz

jazz is js
JavaScript
3
star
41

react-native-web-hacker-news

Objective-C
3
star
42

react-native-generator

JavaScript
3
star
43

ninjs

Javascript Ninja's Garden
JavaScript
3
star
44

node-isabspath

Predicate method for testing whether a path is absolute
JavaScript
3
star
45

Ning

Node.js Web Application Driver (WIP)
JavaScript
3
star
46

commons-algorithm

commons.algorithm
Java
2
star
47

jquery-jsonview

json data visualization for jquery
JavaScript
2
star
48

sublime-mod

Mod for Sublime Text
Python
2
star
49

soundbox.js

JavaScript library for audio processing(WIP)
JavaScript
2
star
50

tencent-hackathon-scoring

Tencent Hackathon Scoring Application
JavaScript
2
star
51

fitnect

Tencent Hackthon Work
JavaScript
2
star
52

stylesheet-loader

JavaScript
2
star
53

select

A micro css selector engine
JavaScript
1
star
54

mircotask

High performance task scheduler
JavaScript
1
star
55

webpack-html-plugin

JavaScript
1
star
56

node-unixifypath

Unixify pathname for Node.js
JavaScript
1
star
57

resume

My Resumé is open
CSS
1
star
58

square-ui

Square User Interface Kit For Mobile Web (Work In Process)
CSS
1
star
59

jquery-storage

cross browser storage module for jquery
JavaScript
1
star