Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@bscop/react-modal

brunoscopelliti14MIT2.0.3TypeScript support: included

Accessible modal (in React).

react modal, react popup, react dialog, react portal, accessible modal, a11y modal

readme

react-modal

GitHub license npm version CircleCI Status Coverage

Accessible modal (in React).

View in Storybook.

Install

npm i @bscop/react-modal

Usage

import Modal from "@bscop/react-modal";

function App () {
  return (
    <Modal 
      renderContent={
        () => {
          return (
            <div>
              <p>This is the content of the modal ...</p>
            </div>
          );
        }
      }
      renderHook={
        (props) => {
          return (
            <button type="button" {...props}>Show modal</button>
          );
        }
      }
      rootId="modal-root"
      title="About"
    />
  );
}

CSS Custom properties

You can set the following CSS Custom properties to customize the look of the dropdown component:

:root {
  --main-color: black;
  --main-bg-color: white;

  --modal-backdrop-bg-color: rgba(0, 0, 0, .2);
  --modal-border-color: rgba(0, 0, 0, .2);
  --modal-internal-border-color: #dee2e6;
}

Contribute

Read the guidelines.

Run tests

npm test

Coverage

Coverage reports are hosted on codecov.

npm run badge:coverage -- --token=<guid>

Bruno Scopelliti\ www.brunoscopelliti.com

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.0.3 (2021-09-21)

2.0.2 (2021-06-07)

2.0.1 (2021-06-03)

Bug Fixes

  • add aria-haspopup attribute on the hook props (4f1c863)

2.0.0 (2021-06-01)

⚠ BREAKING CHANGES

  • switch Modal and ControlledModal behavior.

Bug Fixes

1.0.2 (2021-05-31)

1.0.1 (2021-05-30)

Bug Fixes

1.0.0 (2021-05-26)

Features