CommandPalette
Description
A command palette utility
CommandPalette provides a fast and efficient way for users to navigate an application and trigger commands using only their keyboard. Inspired by modern editors and tools, it allows users to search through a list of actions and execute them with a single keystroke.
API reference
public sealed class CommandPalette : Layer<CommandPalette>A keyboard-driven full-screen command launcher (Ctrl/Cmd-K style) that lets users search and invoke application commands.
Constructors
public CommandPalette(IComponent host, IEnumerable<CommandPaletteAction> actions = null)Creates a CommandPalette whose global Ctrl/Cmd keyboard listener is bound to the lifetime of : the listener is attached when first mounts to the DOM and detached when it is removed. This prevents the palette from leaking listeners (and continuing to respond to its shortcut) after the owning view has been navigated away.
Properties
public bool EnableGlobalShortcut { get; set; }Enables the global shortcut on the component.
public bool EnableGlobalActionShortcuts { get; set; }Enables the global action shortcuts on the component.
public string GlobalShortcutKey { get; set; }Key (combined with Ctrl/Cmd) that toggles the palette globally. Case-insensitive. Defaults to "k".
Methods
public CommandPalette SetActions(IEnumerable<CommandPaletteAction> actions)Sets the actions of the component.
public CommandPalette AddAction(CommandPaletteAction action)Adds the given action to the component.
public sealed class CommandPaletteActionConstructors
Properties
public string Name { get; set; }Gets or sets the name of the component.
public string ParentId { get; set; }Gets or sets the parent id.
public UIcons? Icon { get; set; }Gets or sets the icon shown by the component.
public string[] Shortcut { get; set; }Gets or sets the shortcut.
public bool IsEnabled { get; set; }Gets or sets a value indicating whether the component is interactive (enabled).
public bool IsVisible { get; set; }Gets a value indicating whether the component is currently visible.