Docs · API reference · Verso.Abstractions

IToolbarAction Interface#

Represents an action that can appear on the notebook toolbar or in context menus. Actions expose a command that the user can trigger, with optional enable/disable logic.

public interface IToolbarAction : Verso.Abstractions.IExtension

Implements IExtension

Properties#

ActionId Property#

Unique identifier for this action (e.g. "run-all", "export-pdf").

string ActionId { get; }

Property Value#

System.String

ConfirmationPrompt Property#

Optional prompt asking the user to confirm before the action runs. When non-null, hosts show a confirmation dialog with this text and execute the action only if the user accepts. Intended for destructive actions whose effect cannot be undone (e.g. restarting a kernel, which discards session state). Defaults to null so the action executes immediately on click.

string? ConfirmationPrompt { get; }

Property Value#

System.String

DisplayName Property#

Human-readable label displayed on the toolbar button or menu item.

string DisplayName { get; }

Property Value#

System.String

Icon Property#

Optional icon name or path for the action button.

string? Icon { get; }

Property Value#

System.String

IconOnly Property#

When true, the toolbar renders only the icon and surfaces the DisplayName as a hover tooltip instead of a visible label. Hosts ignore this for actions without an Icon. Defaults to false so the label is shown.

bool IconOnly { get; }

Property Value#

System.Boolean

Remarks#

An icon-only button is worth explaining. Hosts show Description beneath the name in the button's tooltip, which is the only chance to say what the icon means.

IsPrimary Property#

When true, the toolbar gives this action a filled, accent-colored "primary" appearance to mark it as the prominent call to action. Defaults to false for the standard flat button style.

bool IsPrimary { get; }

Property Value#

System.Boolean

Order Property#

Sort order within the placement group. Lower values appear first.

int Order { get; }

Property Value#

System.Int32

Placement Property#

Specifies where the action should appear (e.g. main toolbar, cell toolbar, context menu).

Verso.Abstractions.ToolbarPlacement Placement { get; }

Property Value#

ToolbarPlacement

Methods#

ExecuteAsync(IToolbarActionContext) Method#

Executes the action.

System.Threading.Tasks.Task ExecuteAsync(Verso.Abstractions.IToolbarActionContext context);

Parameters#

context IToolbarActionContext

Context providing access to the current notebook, selection, and services.

Returns#

System.Threading.Tasks.Task
A task that completes when the action has finished executing.

IsEnabledAsync(IToolbarActionContext) Method#

Determines whether the action is currently enabled based on the notebook state.

System.Threading.Tasks.Task<bool> IsEnabledAsync(Verso.Abstractions.IToolbarActionContext context);

Parameters#

context IToolbarActionContext

Context providing access to the current notebook, selection, and services.

Returns#

System.Threading.Tasks.Task<System.Boolean>
true if the action should be enabled; otherwise false.