Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStore
Popover
Popover is a floating container component that provides contextual information positioned relative to a trigger element, such as a button or icon, when a user interacts with it to open the container.
Example
Code

Import

Import the component from @faststore/ui

_10
import { Popover } from '@faststore/ui'

Import styles into your FastStore project

To apply the styles of this component in your FastStore project, import the following into your stylesheet:

_10
@import '@faststore/ui/src/components/molecules/Popover/styles.scss';

Follow the instructions in the Importing FastStore UI component styles tutorial.

Props

NameTypeDescriptionDefault
titlestringThe Popover header's title.
content*string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortalContent of the Popover.
placement"bottom-start" | "bottom-center" | "bottom-end" | "top-start" | "top-center" | "top-end"Defines the side or side-alignment (e.g., "bottom-start", "bottom-center") of the Popover.bottom-start
dismissiblefalse | trueIf the Popover can be closed by a button.false
onDismiss() => voidCalled when the Popover is dismissed.
onEntered() => voidCallback when the Popover is fully rendered and positioned.
closeButtonAriaLabelstringClose button aria-label.Close Popover
isOpen*false | trueControls whether the Popover is open.
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-popover
offsetTopnumberOffset value for top position (e.g.: 12).8
offsetLeftnumberOffset value for left position (e.g.: 12).0
triggerRefRefObject<HTMLElement>Reference to the trigger element that opens the Popover.

Design tokens

Local tokenDefault value/Global token linked
--fs-popover-margin0 var(--fs-spacing-3)
--fs-popover-paddingvar(--fs-spacing-3) var(--fs-spacing-4) var(--fs-spacing-4)
--fs-popover-border-radiusvar(--fs-border-radius)
--fs-popover-bkg-color
var(--fs-color-body-bkg)
--fs-popover-box-shadowvar(--fs-shadow-darker)
--fs-popover-z-indexvar(--fs-z-index-top)
--fs-popover-indicator-sizevar(--fs-spacing-1)
--fs-popover-indicator-distance-edgevar(--fs-spacing-3)
--fs-popover-indicator-distance-basevar(--fs-spacing-1)
--fs-popover-indicator-translatecalc(var(--fs-popover-indicator-size) + var(--fs-popover-indicator-distance-base))

Customization

For further customization, you can use the following data attributes:
data-fs-popover
data-fs-popover-header
data-fs-popover-header-title
data-fs-popover-header-dismiss-button
data-fs-popover-indicator
data-fs-popover-header-placement="top | top-center | top-start | top-end | bottom | bottom-center | bottom-start | bottom-end"
Contributors
2
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
2
Photo of the contributor
Photo of the contributor
On this page