Logo
Animation

Popover

Toggle a small panel with animated open and close states

Overview

Popover controls a panel that opens near a trigger, such as a compact settings panel or extra actions. V2 uses Evo Tween sequences for both directions.


Usage

Add Popover to the panel.

Configure its initial state and open/close sequences.

Bind the trigger’s click to Toggle().

Choose whether outside clicks and Escape close it.


Notes

Manage GameObject State lets the component handle panel activation. Adjust the sequences for movement, scale, and fading.


Public API

Use Popover in the Evo.UI namespace.

Fields

NameTypeDescription
isOpenboolCurrent open-state field; use methods to change it.
closeOnOutsideClickboolCloses on an outside pointer click.
closeOnEscapeKeyboolCloses on Escape.
openAnimationTweenSequenceEvo Tween opening sequence.
closeAnimationTweenSequenceEvo Tween closing sequence.

Methods

NameParametersDescription
Toggle()NoneToggles open/closed state.
Open()NoneOpens with animation.
Close()NoneCloses with animation.
SetStateImmediate()bool openSets state without animation.

Events

NameTypeDescription
onStateChangedUnityEvent<bool>Invoked with true for open or false for closed.

Example

PopoverExample.cs
using UnityEngine;
using Evo.UI;

public class PopoverExample : MonoBehaviour
{
    // Keep this controller outside the panel if closing deactivates it.
    [SerializeField] private Popover target;

    private void Start()
    {
        target.SetStateImmediate(false);
        target.onStateChanged.AddListener(OnStateChanged);
    }

    // Connect these methods to the opening and closing buttons.
    public void ShowPanel() => target.Open();
    public void HidePanel() => target.Close();

    private void OnStateChanged(bool open)
    {
        Debug.Log($"Popover open: {open}");
    }

    private void OnDestroy()
    {
        if (target != null)
            target.onStateChanged.RemoveListener(OnStateChanged);
    }
}

On this page