Collection of theme-ui and external components.
created:3/15/2021
updated:3/15/2021
source lines:85
comments %:7

Popover

Popover container that is triggered by a click/hover event, using react-popper-tooltip.

Component

import { Popover } from '@component-controls/components';

Overview

({ placement, trigger }) => {
const [isOpen, setIsOpen] = useState(false);
return (
<Popover
trigger={trigger}
placement={placement}
tooltipShown={isOpen}
onVisibilityChange={isVisible => {
setIsOpen(isVisible);
}}
tooltip={() => (
<Box>
<Donut value={1 / 2} />
</Box>
)}
>
<Button variant="secondary">Click to open</Button>
</Popover>
);
}

Controls

Name
Description
Default
Controls
placement

Tooltip placement w.r.t. trigger

autoauto-startauto-endtopbottomrightlefttop-starttop-endbottom-startbottom-endright-startright-endleft-startleft-end
bottom
trigger

Event that triggers the tooltip

Trigger
hover

Properties

Name
Description
Default
PopoverOwnProps (1 properties)
arrowVisible

set to false to hide the arrow

boolean
true
TooltipTriggerProps (16 properties)

External dependencies

package
imports
peer
@theme-ui/css
^0.6.0-alpha.7
get
*
react
^17.0.1
ReactFC
*
TooltipTrigger
TooltipTriggerPropsChildrenArg
theme-ui
^0.6.0-alpha.7
ColorModesScale

Internal dependencies

file
imports
"./PopoverUtils"
ArrowWrapper
"../ThemeContext"
useTheme

Component JSX