@acrool/react-dialog
TypeScript icon, indicating that this package has built-in type declarations

1.0.1-test.0 • Public • Published

Acrool React Dialog

Acrool React Dialog Logo

This is a dialog message function for React development dialog

NPM npm npm

npm downloads npm

Features

  • Supports 5 status colors: default, success, info, warning, danger
  • Call via global method
  • Plug and unplug using @acrool/react-portal and framer-motion

Install

yarn add framer-motion @acrool/react-dialog

in your packages. (Make the version of styled-component you use match the version of styled-component used in acrool-react-gird)

"resolutions": {
    "framer-motion": "^11.x"
}

Usage

add in your index.tsx

import "@acrool/react-dialog/dist/index.css";

add in your App.tsx

import {DialogPortal} from "@acrool/react-dialog";

const App = () => {
    return (
        <div>
            <BaseUsed/>

            <DialogPortal
                localeDictionaries={{
                    'en-US': {
                        'com.dialog.success': 'Success',
                        'com.dialog.error': 'Danger',
                        'com.dialog.info': 'Info',
                        'com.dialog.warning': 'Warning',
                        'com.dialog.confirm': 'Confirm',
                        'com.dialog.ok': 'OK',
                        'com.dialog.cancel': 'Cancel',
                    }
                }}
                locale="en-US"
                isVisibleStatusIcon
                renderButton={args => createElement(Button, args, args.children)}
                renderTextField={args => createElement(TextField, args, null)}
            />
            
        </div>
    );
};

then in your page

import {EStatus, toast} from '@acrool/react-dialog';

const Example = () => {
    return (
        <div>
            <button type="button" onClick={() => dialog({message: 'step1 test dialog', code: 'TEST1'})}>
                useDialog message
            </button>
        </div>
    );
};
  • dialog
  • dialog.success
  • dialog.info
  • dialog.warning
  • dialog.error
  • dialog.confirm

There is also a example that you can play with it:

Play react-editext-example

License

MIT © Acrool & Imagine

Dependents (0)

Package Sidebar

Install

npm i @acrool/react-dialog

Weekly Downloads

37

Version

1.0.1-test.0

License

MIT

Unpacked Size

58.1 kB

Total Files

20

Last publish

Collaborators

  • imagine10255