React OverlayPanel is a container component that can overlay other components on page.
Setup
Refer to PrimeReact setup documentation for download and installation steps for your environment.
Import
import { OverlayPanel } from 'primereact/overlaypanel';
Getting Started
OverlayPanel is accessed via its reference where visibility is controlled using toggle, show and hide methods.
<Button type="button" label="Basic" onClick={(e) => op.current.toggle(e)} />
<OverlayPanel ref={op}>
// Content
</OverlayPanel>
Dismissable and CloseIcon
Clicking outside the overlay hides the panel, setting dismissable to false disables this behavior. Additionally enablign showCloseIcon property displays a close icon at the top right corner to close the panel.
<OverlayPanel ref={op} showCloseIcon dismissable>
// Content
</OverlayPanel>
Theming
OverlayPanel supports various themes featuring Material, Bootstrap, Fluent as well as your own custom themes via the Designer tool.
Resources
Visit the PrimeReact OverlayPanel showcase for demos and documentation.