Table of Contents

Class PopoverTriggerContext

Namespace
TwBlazor.Models
Assembly
TwBlazor.dll

What a custom trigger for a TwPopover needs: the attributes that tie it to the panel for assistive technology, and a way to open and close the panel.

[ExcludeFromCodeCoverage]
public sealed class PopoverTriggerContext
Inheritance
PopoverTriggerContext
Inherited Members

Remarks

Splat Attributes onto the element that opens the popover, which should be a button, and call ToggleAsync from its click handler.

Constructors

PopoverTriggerContext(IReadOnlyDictionary<string, object>, bool, Func<Task>)

Initializes a new instance of the PopoverTriggerContext class.

public PopoverTriggerContext(IReadOnlyDictionary<string, object> attributes, bool isOpen, Func<Task> toggleAsync)

Parameters

attributes IReadOnlyDictionary<string, object>

The trigger's id and ARIA attributes.

isOpen bool

Whether the panel is open.

toggleAsync Func<Task>

Opens the panel when it is closed, and closes it when it is open.

Properties

Attributes

Gets the trigger's id and the aria-haspopup, aria-expanded and aria-controls attributes that tie it to the panel.

public IReadOnlyDictionary<string, object> Attributes { get; }

Property Value

IReadOnlyDictionary<string, object>

IsOpen

Gets whether the panel is open.

public bool IsOpen { get; }

Property Value

bool

ToggleAsync

Gets the function that opens the panel when it is closed, and closes it when it is open.

public Func<Task> ToggleAsync { get; }

Property Value

Func<Task>