Class Sealed
public sealed class MokaJsonContextAction

Namespace: Moka.Blazor.Json.Models

Defines a single action available in the JSON viewer context menu.

Properties

NameDescription
HasSeparatorBefore If true, a separator line is rendered before this action.
IconCss Optional CSS class for an icon displayed next to the label.
IconSvg Optional inline SVG markup for an icon displayed next to the label. Takes precedence over MokaJsonContextAction.IconCss when both are set.
Id Unique identifier for this action.
IsEnabled Predicate that determines whether this action is enabled (visible but grayed out if false).
IsVisible Predicate that determines whether this action is visible for the given node. Return false to hide the action for certain node types or depths.
Label Display label shown in the menu.
OnExecute The callback invoked when the user selects this action.
Order Sort order within the menu. Lower values appear first. Default is 0.
ShortcutHint Keyboard shortcut hint displayed in the menu (e.g., "Ctrl+C").

HasSeparatorBefore

bool MokaJsonContextAction.HasSeparatorBefore { get; init; }

If true, a separator line is rendered before this action.

IconCss

string? MokaJsonContextAction.IconCss { get; init; }

Optional CSS class for an icon displayed next to the label.

IconSvg

string? MokaJsonContextAction.IconSvg { get; init; }

Optional inline SVG markup for an icon displayed next to the label. Takes precedence over MokaJsonContextAction.IconCss when both are set.

Id

string MokaJsonContextAction.Id { get; init; }

Unique identifier for this action.

IsEnabled

Func<MokaJsonNodeContext, bool>? MokaJsonContextAction.IsEnabled { get; init; }

Predicate that determines whether this action is enabled (visible but grayed out if false).

IsVisible

Func<MokaJsonNodeContext, bool>? MokaJsonContextAction.IsVisible { get; init; }

Predicate that determines whether this action is visible for the given node. Return false to hide the action for certain node types or depths.

Label

string MokaJsonContextAction.Label { get; init; }

Display label shown in the menu.

OnExecute

Func<MokaJsonNodeContext, ValueTask> MokaJsonContextAction.OnExecute { get; init; }

The callback invoked when the user selects this action.

Order

int MokaJsonContextAction.Order { get; init; }

Sort order within the menu. Lower values appear first. Default is 0.

ShortcutHint

string? MokaJsonContextAction.ShortcutHint { get; init; }

Keyboard shortcut hint displayed in the menu (e.g., "Ctrl+C").

View Source
/// <summary>
///     Defines a single action available in the JSON viewer context menu.
/// </summary>
public sealed class MokaJsonContextAction
{
    /// <summary>
    ///     Unique identifier for this action.
    /// </summary>
    public required string Id { get; init; }
    /// <summary>
    ///     Display label shown in the menu.
    /// </summary>
    public required string Label { get; init; }
    /// <summary>
    ///     Optional CSS class for an icon displayed next to the label.
    /// </summary>
    public string? IconCss { get; init; }
    /// <summary>
    ///     Optional inline SVG markup for an icon displayed next to the label.
    ///     Takes precedence over <see cref = "IconCss"/> when both are set.
    /// </summary>
    public string? IconSvg { get; init; }
    /// <summary>
    ///     Keyboard shortcut hint displayed in the menu (e.g., "Ctrl+C").
    /// </summary>
    public string? ShortcutHint { get; init; }
    /// <summary>
    ///     Predicate that determines whether this action is visible for the given node.
    ///     Return <c>false</c> to hide the action for certain node types or depths.
    /// </summary>
    public Func<MokaJsonNodeContext, bool>? IsVisible { get; init; }
    /// <summary>
    ///     Predicate that determines whether this action is enabled (visible but grayed out if false).
    /// </summary>
    public Func<MokaJsonNodeContext, bool>? IsEnabled { get; init; }
    /// <summary>
    ///     The callback invoked when the user selects this action.
    /// </summary>
    public required Func<MokaJsonNodeContext, ValueTask> OnExecute { get; init; }
    /// <summary>
    ///     Sort order within the menu. Lower values appear first. Default is <c>0</c>.
    /// </summary>
    public int Order { get; init; }
    /// <summary>
    ///     If <c>true</c>, a separator line is rendered before this action.
    /// </summary>
    public bool HasSeparatorBefore { get; init; }
}
Was this page helpful?