Logo
Animation

Popover

An animated overlay component with outside-click and escape-key dismissal

Overview

Popover displays a UI element with animated entry and exit transitions. It supports multiple animation types, automatic dismissal on outside clicks or the escape key, and optional GameObject lifecycle management, making it ideal for tooltips, dropdowns, and contextual menus.


Usage

Select a UI object to use as the popover panel

Add the Popover component (CanvasGroup and RectTransform will be added automatically)

Choose an Animation Type and configure timing and curve as needed

Call Open(), Close(), or Toggle() from a button or script to control visibility


Properties

Settings

NameTypeDescription
isOpenboolWhether the popover starts in the open state
manageGameObjectStateboolAutomatically activates/deactivates the GameObject when opening or closing
closeOnOutsideClickboolCloses the popover when the user clicks outside of it
closeOnEscapeKeyboolCloses the popover when the Escape key is pressed

Animation

NameTypeDescription
animationTypeAnimationTypeThe style of animation to use: None, Fade, Scale, or Slide
animationCurveAnimationCurveEasing curve controlling animation progression
animationDurationfloatDuration of the open and close animations in seconds
scaleFromfloatStarting scale factor for the Scale animation type
slideOffsetVector2Positional offset the panel slides in from for the Slide animation type

Events

NameTypeDescription
onShowUnityEventInvoked when the popover begins opening
onHideUnityEventInvoked when the popover begins closing

Enums

AnimationType

ValueDescription
NoneInstantly shows or hides the popover with no transition
FadeFades the canvas group alpha in or out
ScaleScales and fades the panel from scaleFrom to full size
SlideSlides and fades the panel in from a positional offset

Public Methods

NameParametersDescription
Open()NoneOpens the popover with the configured animation
Close()NoneCloses the popover with the configured animation
Toggle()NoneOpens the popover if closed, or closes it if open
SetStateImmediate(bool open)open — target stateInstantly snaps the popover open or closed without playing any animation

Code Example

PopoverExample.cs
using UnityEngine;
using Evo.UI;

public class PopoverExample : MonoBehaviour
{
    public Popover popover;

    void YourMethod()
    {
        // Configure dismiss behavior
        popover.closeOnOutsideClick = true;
        popover.closeOnEscapeKey = true;

        // Configure animation
        popover.animationType = Popover.AnimationType.Scale;
        popover.animationDuration = 0.2f;
        popover.scaleFrom = 0.8f;

        // Subscribe to events
        popover.onShow.AddListener(() => Debug.Log("Popover opened"));
        popover.onHide.AddListener(() => Debug.Log("Popover closed"));

        // Open the popover
        popover.Open();

        // Toggle animation
        popover.Toggle();

        // Instantly close without animation
        popover.SetStateImmediate(false);
    }
}

On this page