sweetalert2-react16

0.6.1 • Public • Published

sweetalert2-react

NPM version Dependency Status

Declarative SweetAlert in React

Introduction

This package is forked from https://github.com/alex-shamshurin/sweetalert2-react, which is forked from https://github.com/chentsulin/sweetalert-react and adopted for https://github.com/limonte/sweetalert2

Install

$ npm install sweetalert2-react16

Usage

import React, { Component } from 'react';
import SweetAlert from 'sweetalert2-react';

// ...

render() {
  return (
    <div>
      <button onClick={() => this.setState({ show: true })}>Alert</button>
      <SweetAlert
        show={this.state.show}
        title="Demo"
        text="SweetAlert in React"
        onConfirm={() => this.setState({ show: false })}
      />
    </div>
  );
}

You should import sweetalert2.css from 'sweetalert2' package.

Checkout full examples https://github.com/chentsulin/sweetalert-react

Tests

Test were not updated to support sweetalert2. PRs are welcome.

License

MIT © C.T. Lin

Package Sidebar

Install

npm i sweetalert2-react16

Weekly Downloads

1

Version

0.6.1

License

MIT

Last publish

Collaborators

  • snoo-mpl