Code Monkey home page Code Monkey logo

react-modal's Introduction

Modal

React component for when you need a modal.

Usage

<link href="Modal.css" rel="stylesheet" />
<script src="http://fb.me/react-0.12.2.js" type="application/javascript"></script>
<script src="Modal.js" type="application/javascript"></script>
<Modal
	visible={ Boolean() }
	onShow={ function(){} }
	onHide={ function(){} }>

	<header>
		<h1>Your Modal</h1>
	</header>

	<p>Hello there</p>
</Modal>
Modal({
		visible: Boolean(),
		onShow: function(){},
		onHide: function(){}
	},
	React.createElement('header', null, React.createElement('h1', null, "Your Modal")),
	React.createElement('p', null, "Hello there"))
  • visible (Boolean) can be used to toggle visibility of the modal, defaults to false.

  • onShow (function) is called when the modal becomes visible, defaults to an empty function.

  • onHide (function) is called when the modal becomes not visible, default to an empty function.

Public API

  • toggleVisibility() (function) may be called to toggle the modal visibility.

  • show() (function) may be called to make the modal visible.

  • hide() (function) may be called to make the modal not visible.

What it does

Displays a modal and prevents the document from scrolling while visible.

The modal contains a close button and clicking on the translucent part of the overlay will also cause the modal to hide.

Why

Because React is awesome and modals are useful.

How you can help

File an issue if you find anything isn't working as expected.

Pull requests are always welcome, but you should open an issue before working on a new feature (both to ensure it's within the scope of this project and that it's not already being worked on).

react-modal's People

Contributors

jvatic avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.