1.1.2 • Published 4 years ago

react-fusionui v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

React FusionUI ☢️

npm npm downloads npm bundle size

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

Installation

# npm
npm i react-fusionui

# yarn
yarn add react-fusionui

Basic Usage

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

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
ArgDescriptionTypeRequired
ComponentComponent you want to render inside the modal.FunctionalComponentYES
configModal configuration.Object
Config Object
NameDescriptionTypeRequired
propsProps you want to pass to the component you specified.Object
autocloseShould your component close when user clicks outside of your modal.Boolean

useDialog

Args
ArgDescriptionTypeRequired
contentContent of the dialog.ReactNodeYES
actionsActions which will be rendered as buttons.ArrayYES
configDialog configuration.Object
Action Object
NameDescriptionTypeRequired
labelLabel of the button.StringYES
callbackWill run when the button is clicked.Function
highlightApply highlight styles to the button.Boolean
Config Object
NameDescriptionTypeRequired
autocloseShould the dialog close when user clicks outside of the dialog.Boolean

License

MIT

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago