
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-customizable-modal
Advanced tools
Customizable Modal component for React

$ npm install --save-dev react-customizable-modal
// CommonJS
require('react-customizable-modal/style.css');
var Modal = require('react-customizable-modal');
// ES2015 Modular Syntax
import 'react-customizable-modal/style.css';
import Modal from 'react-customizable-modal';
Above examples can found here: https://github.com/rico345100/react-customizable-modal-example.
Example for creating simple custom modal:
import 'react-customizable-modal/style.css';
import Modal from 'react-customizable-modal';
class CustomModal extends Component {
static propTypes = {
visible: PropTypes.bool.isRequired,
onClose: PropTypes.func
}
static defaultProps = {
onClose: () => {}
}
render() {
return (
<Modal name="Custom Modal" visible={this.props.visible} onSubmit={this.props.onClose} onClose={this.props.onClose}>
<h1>Helloworld!</h1>
</Modal>
)
}
}
class App extends Component {
state = {
showModal: false
}
toggleModal = () => {
this.setState({ showModal: !this.state.showModal });
}
closeModal = () => {
this.setState({ showModal: false });
}
render() {
return (
<div>
<h1>Modal Test</h1>
<button onClick={this.toggleModal}>Toggle</button>
{/* Modal must be render always, and control visiblity via visible props */}
<CustomModal visible={this.state.showModal} onClose={this.closeModal} />
</div>
);
}
}
Example for creating custom modal has form(using with react-bootstrap):
import React, { Component, PropTypes } from 'react';
import { FormGroup, ControlLabel, FormControl } from 'react-bootstrap';
import Modal from 'react-customizable-modal';
class AddAccountModal extends Component {
static propTypes = {
onClose: PropTypes.func,
visible: PropTypes.bool.isRequired
}
state = {
name: '',
age: ''
}
onAdd = () => {
console.log('Add: ', this.state);
}
onClose = () => {
this.props.onClose();
}
handleChange(key, ev) {
this.setState({
[key]: ev.target.value
});
}
render() {
const { visible } = this.props;
const { name, age } = this.state;
return (
<Modal name="Add Account" onSubmit={this.onAdd} onClose={this.onClose} submitText="Add" closeText="Close" visible={visible}>
<div className="form-horizontal">
<FormGroup>
<ControlLabel>Name</ControlLabel>
<FormControl type="text" value={name} onChange={this.handleChange.bind(this, 'name')} />
</FormGroup>
<FormGroup>
<ControlLabel>Age</ControlLabel>
<FormControl type="text" value={age} onChange={this.handleChange.bind(this, 'age')} />
</FormGroup>
</div>
</Modal>
);
}
}
export default AddAccountModal;
MIT. Free to use.
FAQs
Customizable modal component for React Application
The npm package react-customizable-modal receives a total of 1 weekly downloads. As such, react-customizable-modal popularity was classified as not popular.
We found that react-customizable-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.