3.18.0 • Published 4 days ago

@s-ui/react-atom-popover v3.18.0

Weekly downloads
1,237
License
MIT
Repository
-
Last release
4 days ago

AtomPopover

AtomPopover is a component that wraps an element and shows a popover around it.

Installation

$ npm install @s-ui/react-atom-popover --save

Usage

Basic usage

import AtomPopover, { atomPopoverPositions } from '@s-ui/react-atom-popover'
<AtomPopover
  placement={atomPopoverPositions.BOTTOM}
  onClose={() => console.log("CLOSE POPOVER!")}
  content={
    <>
      Hello <strong>world</strong>!
    </>
  }
>
  <div>
    Show Popover
  </div>
</AtomPopover>

Some times you may need to programmatically recalculate the AtomPopover position in order to fix visual inconsistencies (i.e. a change on the popover content could change the popover size, and therefore recalculating the position may be needed to ensure that popover is displayed as expected). To do so, it's possible to provide a component in the AtomPopover's content property, this component will receive a function inside a property named update, calling this function will result on a popover's position recalculation.

<AtomPopover
  placement={atomPopoverPositions.BOTTOM}
  onClose={() => console.log("CLOSE POPOVER!")}
  content={({update}) =>
    <>
      Hello <strong>world</strong>!
      <button onClick={update}>Click me to recalculate the popover position!</button>
    </>
  }
>
  <div>
    Show Popover
  </div>
</AtomPopover>

The update prop is a function provided by Popper (v1), which is the library in charge of rendering and positioning the popover component. You can get more information about this function here: https://popper.js.org/docs/v1/#Popper.scheduleUpdate

Find full description and more examples in the demo page.

3.18.0

4 days ago

3.15.0

2 years ago

3.14.0

2 years ago

3.17.0

2 years ago

3.16.0

2 years ago

3.13.0

2 years ago

3.12.0

2 years ago

3.11.0

2 years ago

3.9.0

2 years ago

3.10.0

2 years ago

3.8.0

2 years ago

3.7.0

2 years ago

3.6.0

2 years ago

3.4.0

3 years ago

3.5.0

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

2.3.0

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.14.0

3 years ago

1.13.0

3 years ago

1.11.0

3 years ago

2.0.0-beta.1

4 years ago

2.0.0-beta.0

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago