2.0.0 • Published 4 years ago

@jonny/popover v2.0.0

Weekly downloads
227
License
ISC
Repository
github
Last release
4 years ago

@jonny/popover

The popover that I use in my projects :)

Usage

import Popover from '@jonny/popover'

export default () => {
    const [popover, setPopover] = useState(false);
    return (
        <Popover
          popupVisible={popover}
          preferredPlacement="bottom"
          onClose={() => {
            setPopover(false);
          }}
          tip={<div>hi there</div>}
        >
          <Button onClick={() => setPopover(!popover)}>Click on me</Button>
        </Popover>
    )
}

Props

tip

Either string or React Markup

popupVisible

Whether the popup is open.

onClose

Callback for when clicked outside the popup or if Escape was pressed.

preferredPlacement

A PopperJS.Placement - one of:

'auto-start' | 'auto' | 'auto-end' | 'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-end' | 'bottom' | 'bottom-start' | 'left-end' | 'left' | 'left-start'

Note that the tooltip might end up being placed differently to avoid the edges of the viewport.

arrowSize

Size of the arrow of the tooltip. Default is 8 resulting in a 8x8px square rotated.

style

Styles to be applied to both the bubble and the arrow. For borders, use the props instead.

bubbleStyle

Styles to be applied to the bubble.

arrowStyle

Styles to be applied to the arrow.

bubbleProps

Props to be applied to the bubble <div>

arrowProps

Props to be applied to the arrow <div>.

borderWidth

Width of the Tooltip border (bubble and arrow). Default: 0

bubbleBorderWidth

Width of the border of the tooltip bubble. Overrides borderWidth

arrowBorderWidth

Width of the border of the tooltip arrow. Overrides borderWidth

borderColor

Color of the Tooltip border (bubble and arrow). Default #b3b3b3

bubbleBorderWidth

Color of the bubble border. Overrides borderColor

arrowBorderWidth

Color of the arrow border. Overrides borderColor

borderStyle

Style of the Tooltip border (bubble and arrow). Default solid

bubbleBorderStyle

Border style of the Tooltip bubble. Overrides borderStyle

arrowBorderStyle

Border style of the Tooltip arrow. Overrides borderStyle

Also see

1.0.0

4 years ago

2.0.0

4 years ago

1.0.0-alpha.30

5 years ago

1.0.0-alpha.31

5 years ago

1.0.0-alpha.29

6 years ago

1.0.0-alpha.28

6 years ago

1.0.0-alpha.27

6 years ago

1.0.0-alpha.26

6 years ago

1.0.0-alpha.25

6 years ago

1.0.0-alpha.24

6 years ago

1.0.0-alpha.23

6 years ago

1.0.0-alpha.22

6 years ago

1.0.0-alpha.21

6 years ago

1.0.0-alpha.20

6 years ago

1.0.0-alpha.19

6 years ago

1.0.0-alpha.17

6 years ago

1.0.0-alpha.16

6 years ago

1.0.0-alpha.15

6 years ago

1.0.0-alpha.14

6 years ago

1.0.0-alpha.13

6 years ago

1.0.0-alpha.12

6 years ago

1.0.0-alpha.11

6 years ago

1.0.0-alpha.10

6 years ago

1.0.0-alpha.9

6 years ago

1.0.0-alpha.8

6 years ago