Popover
The Popover component is used to render a floating card with respect to a target. The Popover component uses
children
and content
prop to render the target and the floating card respectively.
The
children
is a single child element of thePopover
component
#
Usage#
Code#
TriggerThe Popver component can show the popup content either triggered by a click or a hover event, this can be achieved by using the
trigger
prop which accepts "click"
or "hover"
strings as its value
#
Code#
PlacementThe Popover component position can be varied by using the placement
prop which accepts a string value.
The accepted values are the following, each reperesents a seperate position for the component,
"right"
"right-start"
"right-end"
"top"
"top-start"
"top-end"
"left"
"left-start"
"left-end"
"bottom"
"bottom-start"
"bottom-end"
#
Placement Example#
Center#
Code#
Start#
Code#
End#
Code#
Close from within the contentThe Popover content can be closed from within by using togglePopup
prop. This prop is used when the value is changed
so if it is required to close the popup content from within set the value for togglePopup
as false
#
Code#
APIProp | Type | Possible values | Default Value |
---|---|---|---|
children | ReactNode | - | - |
content | ReactNose | - | - |
trigger | string | "click" and "hover" | "click" |
placement | string | "right" ,"right-start" ,"right-end" ,"top" ,"top-start" ,"top-end" ,"left" ,"left-start" ,"left-end" ,"bottom" ,"bottom-start" and "bottom-end" | "bottom" |
hideArrow | boolean | true and false | false |
togglePopup | boolean | true and false | false |
Built by Akshay 🤙