Accessible, lightweight and configurable modal component with a11y-enabled.
Accessible, lightweight and configurable modal component with a11y-enabled inspired by Micromodal.js.
npm install react-micro-modal
yarn add react-micro-modal
Escape
keypressHere is a minimal uncontrolled modal example in 3 lines of code.
import React from 'react';
import { render } from 'react-dom';
import MicroModal from 'react-micro-modal';
const App = () => {
return (
<MicroModal trigger={(open) => <div onClick={open}>Open!</div>}>
{(close) => <button onClick={close}>Close!</button>}
</MicroModal>
);
};
render(<App ></App>, document.getElementById('root'));
For more examples of micro-modal in action, go to https://meemaw.github.io/react-micro-modal.
OR
To run that demo on your own computer:
yarn install
yarn storybook