1.1.11 • Published 4 years ago

@malcodeman/react-popover v1.1.11

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

react-popover

GitHub license npm code style: prettier

The Popover component displays floating content in relation to a target. Popovers appear either at the top, bottom, left or right of their target. The preferred and default side is the bottom. Popovers use smart positioning if there is not enough space.

Getting started

yarn add @malcodeman/react-popover
# or
npm install --save @malcodeman/react-popover
import React from "react";
import { StatefulPopover } from "@malcodeman/react-popover";

function App() {
  return (
    <StatefulPopover content={() => <div>PopoverContent</div>}>
      <button>Trigger Popover</button>
    </StatefulPopover>
  );
}

export default App;

Stateless example

import React from "react";
import { Popover } from "@malcodeman/react-popover";

function App() {
  const [isOpen, setIsOpen] = React.useState(false);

  return (
    <Popover isOpen={isOpen} content={() => <div>PopoverContent</div>}>
      <button onClick={() => setIsOpen(!isOpen)}>Trigger Popover</button>
    </Popover>
  );
}

export default App;

License

MIT

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

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