React Popover Component API

Popover API

Rocket
New Year sale. Skyrocket your business in 2025!
Extra 25% off for all sale items + Free CoreUI Icons PRO with every order!
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.

Explore the API reference for the React Popover component and discover how to effectively utilize its props for customization.

On this page

CPopover#

import { CPopover } from '@coreui/react'
// or
import CPopover from '@coreui/react/src/components/popover/CPopover'
PropertyDefaultType
animation#4.9.0+trueboolean

Adds a fade transition animation to the React Popover.

className#-string

Custom class name(s) for additional styling.

container#4.11.0+document.bodyElement, DocumentFragment, (() => Element | DocumentFragment)

Defines the container element to which the React Popover is appended.
Accepts:

  • A DOM element (HTMLElement or DocumentFragment)
  • A function that returns a single element
  • null (defaults to document.body)
<CPopover container={document.getElementById('my-container')}>...</CPopover>
content#-ReactNode

Main content of the React Popover. It can be a string or any valid React node.

delay#4.9.0+0number, { show: number; hide: number; }

Delay (in milliseconds) before showing or hiding the React Popover.

  • If a number is provided, that delay applies to both "show" and "hide".
  • If an object is provided, use separate values for "show" and "hide".
// Delays 300ms on both show and hide
<CPopover delay={300}>...</CPopover>
// Delays 500ms on show and 100ms on hide
<CPopover delay={{ show: 500, hide: 100 }}>...</CPopover>
fallbackPlacements#4.9.0+['top', 'right', 'bottom', 'left']'top', 'right', 'bottom', 'left', ('top', 'right', 'bottom', 'left')[]

Specifies the fallback placements when the preferred placement cannot be met.

offset#[0, 8][number, number]

Offset of the React Popover relative to its toggle element, in the form [x, y].

// Offset the menu 0px in X and 10px in Y direction
<CPopover offset={[0, 10]}>...</CPopover>
// Offset the menu 5px in both X and Y direction
<CPopover offset={[5, 5]}>...</CPopover>
onHide#-() => void

Invoked when the React Popover is about to hide.

onShow#-() => void

Invoked when the React Popover is about to show.

placement#top'auto', 'top', 'bottom', 'right', 'left'

Placement of the React Popover. Popper.js may override this based on available space.

popperConfig#5.5.0+-Partial<Options>, ((defaultPopperConfig: Partial<Options>) => Partial<Options>)

Allows customization of the Popper.js configuration for the React Popover.
Can be an object or a function returning a modified configuration.
Learn more

<CPopover
popperConfig={(defaultConfig) => ({
...defaultConfig,
strategy: 'fixed',
modifiers: [
...defaultConfig.modifiers,
{ name: 'computeStyles', options: { adaptive: false } },
],
})}
>...</CPopover>
title#-ReactNode

Title for the React Popover header. Can be a string or any valid React node.

trigger#click'hover', 'focus', 'click', ('hover' | 'focus' | 'click')[]

Determines which events trigger the visibility of the React Popover. Can be a single trigger or an array of triggers.

// Hover-only tooltip
<CPopover trigger="hover">...</CPopover>
// Hover + click combined
<CPopover trigger={['hover', 'click']}>...</CPopover>
visible#-boolean

Controls the visibility of the React Popover.

  • true shows the popover.
  • false hides the popover.