Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

boron

> 编程语言
Open source

A collection of dialog animations with React.js

1.5K stars0 likes1 views
WebsiteGitHub

About

A collection of dialog animations with React.js

Boron

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 (
            

        );
    }
});

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 (
            

        );
    }
});

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 (
            

        );
    }
});

Modals

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

Browser Support

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

License

Boron is MIT licensed.

GitHub Issues· 34 open

View all on GitHub
  • #57

    Financing

    Updated Jul 3, 2020
  • #55

    browserify transform dependencies must be non-dev dependencies

    Updated Mar 11, 2019
  • #54

    React 16 support

    Updated Oct 10, 2018
  • #53

    Please release 0.2.4 version to fix translate3d bug

    Updated Jul 24, 2018
  • #51

    Demo page not working?

    Updated Jun 19, 2018
  • #47

    Best fork of this library?

    Updated Apr 27, 2018
  • #39

    React.createClass is deprecated and will be removed in version 16.

    Updated Apr 10, 2018
  • #38

    Using PropTypes via the main React package is deprecated

    Updated Apr 10, 2018
  • #36

    Typescript support

    Updated Jan 26, 2018
  • #46

    how to close and open modal using state other than refs(using state's)

    Updated Nov 30, 2017

Highlights

  • •React 0.14+ Use boron 0.2
  • •React 0.12+ Use boron 0.1
  • •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

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言