@codecraftkit
Documentation
Popover is a non-modal dialog that floats around a trigger. It is used to display contextual information to the user, and should be paired with a clickable trigger element.
This component is based on Popover
it can be imported from the core.
import { Popover } from "@codecraftkit/core";
or alone.
import Popover from "@codecraftkit/popover";
A simple popover box with a text
<Popoverlabel="Open Popover"title='Hello World'body="Good Morning, I am a Popover"footer="I am the footer"/>
Focus an element when Popover opens
function MyApp() {const initialFocusRef = React.useRef()return <PopoverinitialFocusRef={initialFocusRef}placement="bottom"closeOnBlur={false}label="Open Popover"title="Helloooo"body="Popover Boy"footer={<ButtonGroup size="sm"><ButtoncolorScheme="green">Setup Email</Button><ButtoncolorScheme="blue"ref={initialFocusRef}>Next</Button></ButtonGroup>}/>}
label
String
yes
The button label
body
String
React Component
no
The content of the popover
children
React Component
no
The content of the popover, but you can use the children prop
variant
solid
link
outline
ghost
unstyled
no
solid
Button style variant
title
String
yes
The Title section
footer
String
yes
The Footer section
trigger
ReactComponent
no
Custom Trigger Component
closeButton
Boolean
no
true
Show close Button
hasArrow
Boolean
no
true
Show arrow
width
styles<object>
no
Modify the popover content width
styles
styles<object>
no
Apply custom styles for the button
popoverContent
styles<object>
no
Apply custom styles for the popover content
popoverHeader
styles<object>
no
Apply custom styles for the popover header
popoverBody
styles<object>
no
Apply custom styles for the popover body
popoverFooter
styles<object>
no
Apply custom styles for the popover footer
popoverTrigger
styles<object>
no
Apply custom styles for the popover trigger