# react-fusionui

> Nuclear power-up for your UI.

Latest version **1.1.2** (published 2020-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-fusionui
pnpm add react-fusionui
yarn add react-fusionui
bun add react-fusionui
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2020-07-26 |
| First published | 2020-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 54.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | ozanbolel |
| Maintainers | ozanbolel |
| Keywords | react, hooks, react-component, modal, dialog |

## Links

- npm: https://www.npmjs.com/package/react-fusionui
- Repository: https://github.com/ozanbolel/react-fusionui
- Homepage: https://github.com/ozanbolel/react-fusionui#readme
- Issues: https://github.com/ozanbolel/react-fusionui/issues
- npm.io page: https://npm.io/package/react-fusionui

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2020-07-26
- 1.1.1 — 2020-07-26
- 1.1.0 — 2020-07-25
- 1.0.2 — 2020-07-23
- 1.0.1 — 2020-07-22
- 1.0.0 — 2020-07-22
- 0.1.6 — 2020-07-17
- 0.1.5 — 2020-07-16
- 0.1.4 — 2020-07-16
- 0.1.3 — 2020-07-15
- 0.1.2 — 2020-07-15
- 0.1.1 — 2020-07-15
- 0.1.0 — 2020-07-15

## README

## React FusionUI ☢️

[![npm](https://img.shields.io/npm/v/react-fusionui.svg)](https://www.npmjs.com/package/react-fusionui) [![npm downloads](https://img.shields.io/npm/dt/react-fusionui.svg)](https://www.npmjs.com/package/react-fusionui) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-fusionui)

Open modals and dialogs with ease! 🚀 FusionUI is an **unopinionated** and minimalist library to power-up your UI.

## **Demo with Examples**

[ozanbolel.github.io/react-fusionui](https://ozanbolel.github.io/react-fusionui)

## **Installation**

```bash
# npm
npm i react-fusionui

# yarn
yarn add react-fusionui
```

## **Basic Usage**

```jsx
import React from "react";
import { FusionContainer, useModal } from "react-fusionui";

const Modal = ({ isAnimationDone, isClosing, closeModal }) => {
  return <h2>Modal</h2>;
};

const Home = () => {
  const modal = useModal();

  return <button onClick={() => modal(Modal)}>Open Modal</button>;
};

const MyApp = () => {
  return (
    <FusionContainer>
      <Home />
    </FusionContainer>
  );
};

export default MyApp;
```

> You need to wrap your app within `FusionContainer`.

> FusionUI passes `isAnimationDone`, `isClosing` and `closeModal` props to your modal component.

## **Theming**

```jsx
import React from "react";
import { FusionContainer } from "react-fusionui";
import css from "./App.module.css";

const MyApp = () => {
  return (
    <FusionContainer
      modalClassNames={{
        container: css.container,
        modal: css.modal
      }}
      dialogClassNames={{
        container: css.container,
        dialog: css.dialog,
        content: css.content,
        actionContainer: css.actionContainer,
        action: css.action,
        actionLabel: css.actionLabel,
        highlight: css.highlight
      }}
    >
      ...
    </FusionContainer>
  );
};

export default MyApp;
```

## **API**

### **useModal**

##### Args

| Arg             | Description                                    |        Type         | Required |
| --------------- | ---------------------------------------------- | :-----------------: | :------: |
| **`Component`** | Component you want to render inside the modal. | FunctionalComponent |   YES    |
| **`config`**    | Modal configuration.                           |       Object        |          |

##### Config Object

| Name            | Description                                                         |  Type   | Required |
| --------------- | ------------------------------------------------------------------- | :-----: | :------: |
| **`props`**     | Props you want to pass to the component you specified.              | Object  |          |
| **`autoclose`** | Should your component close when user clicks outside of your modal. | Boolean |          |

### **useDialog**

##### Args

| Arg           | Description                                |   Type    | Required |
| ------------- | ------------------------------------------ | :-------: | :------: |
| **`content`** | Content of the dialog.                     | ReactNode |   YES    |
| **`actions`** | Actions which will be rendered as buttons. |   Array   |   YES    |
| **`config`**  | Dialog configuration.                      |  Object   |          |

##### Action Object

| Name            | Description                           |   Type   | Required |
| --------------- | ------------------------------------- | :------: | :------: |
| **`label`**     | Label of the button.                  |  String  |   YES    |
| **`callback`**  | Will run when the button is clicked.  | Function |          |
| **`highlight`** | Apply highlight styles to the button. | Boolean  |          |

##### Config Object

| Name            | Description                                                     |  Type   | Required |
| --------------- | --------------------------------------------------------------- | :-----: | :------: |
| **`autoclose`** | Should the dialog close when user clicks outside of the dialog. | Boolean |          |

## License

[MIT](https://github.com/ozanbolel/react-fusionui/blob/master/LICENSE)

---
_Source: https://npm.io/package/react-fusionui · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
