lara-light-indigo

OverlayPanel

OverlayPanel also known as Popover, is a container component that can overlay other components on page.

Import via Module

import { OverlayPanel } from 'primereact/overlaypanel';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/overlaypanel/overlaypanel.min.js"></script>
 
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>
 
Responsive

OverlayPanel width can be adjusted per screen size with the breakpoints option. In example below, default width is set to 450px and below 961px, width would be 75vw and finally below 641px width becomes 100%. The value of breakpoints should be an object literal whose keys are the maximum screen sizes and values are the widths per screen.


<OverlayPanel ref={op} breakpoints={{'960px': '75vw', '640px': '100vw'}} style={{width: '450px'}}>
    // Content
</OverlayPanel>
 
Properties
NameTypeDefaultDescription
idstringnullUnique identifier of the element.
dismissablebooleantrueEnables to hide the overlay when outside is clicked.
showCloseIconbooleanfalseWhen enabled, displays a close icon at top right corner.
stylestringnullInline style of the element.
classNamestringnullStyle class of the element.
appendToDOM element | stringdocument.bodyDOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The self value is used to render a component where it is located.
ariaCloseLabelstringcloseAria label of the close icon.
breakpointsobjectnullObject literal to define widths per screen size.
transitionOptionsobjectnullThe properties of CSSTransition can be customized, except for "nodeRef" and "in" properties.
Events
NameParametersDescription
onShow-Callback to invoke when overlay becomes visible.
onHide-Callback to invoke when overlay becomes hidden.
Methods
NameParametersDescription
toggleevent: Browser eventToggles the visiblity of the overlay.
showevent: Browser event
target: Optional target if event.target should not be used
Shows the overlay.
hide-Hides the overlay.
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-overlaypanelContainer element.
p-overlaypanel-contentContent of the panel.
p-overlaypanel-closeClose icon.
Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma