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

0.18.0 • Public • Published

@another-ui/dialog

Just another dialog component for React

Usage

import React from 'react';
import { Dialog, DialogProvider, useDialog } from '@another-ui/dialog';
import '@another-ui/dialog/dist/dialog.css';

const DemoDialog = () => {
  const { hide } = useDialog();
  return (
    <Dialog
      className="custom-class"
      onClickOverlay={() => hide()}
      overlay
      padding
      scrolling
      theme="dark"
    >
      <h1>Demo</h1>
      <button onClick={() => hide()} type="button">Hide</button>
    </Dialog>
  );
};

const ShowDialogButton = () => {
  const { show } = useDialog();
  return <button onClick={() => show('DemoDialog')} type="button">Show</button>;
};

export const Example = () => (
  <DialogProvider components={{ DemoDialog }}>
    <ShowDialogButton />
  </DialogProvider>
);

Package Sidebar

Install

npm i @another-ui/dialog

Weekly Downloads

1

Version

0.18.0

License

MIT

Unpacked Size

24.9 kB

Total Files

26

Last publish

Collaborators

  • nghuudan