CommandPalette Component — sgcHTML | eSeGeCe

CommandPalette

TsgcHTMLComponent_CommandPalette — the Ctrl+K / Cmd+K overlay launcher familiar from VS Code, Slack and Linear, with substring-then-fuzzy filtering, categories and server-routed actions, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_CommandPalette

Add entries with AddItem or Items.Add, then read the HTML property; Ctrl+K (or Cmd+K) opens the overlay, typing filters it, Enter activates the selection.

Component class

TsgcHTMLComponent_CommandPalette

Renders

Hidden Ctrl+K overlay + inline script

Languages

Delphi, C++ Builder, .NET

Add entries, hit Ctrl+K

Entries are rendered as markup on the server, not shipped to the browser as JSON to filter client-side, so every caption is HTML-encoded exactly once.

uses
  sgcHTML_Component_CommandPalette;

var
  oPalette: TsgcHTMLComponent_CommandPalette;
begin
  oPalette := TsgcHTMLComponent_CommandPalette.Create(nil);
  try
    oPalette.PaletteID := 'app_commands';

    oPalette.AddItem('New Invoice', '/invoices/new', 'invoice:new', 'Create', 'Ctrl+N');
    oPalette.AddItem('Customer Search', '/customers', '', 'Navigate');
    with oPalette.Items.Add do
    begin
      Caption := 'Export Report';
      Icon := 'bi bi-download';
      DataAction := 'report:export';
      Category := 'Actions';
    end;

    WebModule.Response := oPalette.HTML;   // hidden overlay + inline script
  finally
    oPalette.Free;
  end;
end;
// includes: sgcHTML_Component_CommandPalette.hpp

TsgcHTMLComponent_CommandPalette *oPalette = new TsgcHTMLComponent_CommandPalette(NULL);
try
{
  oPalette->PaletteID = "app_commands";

  oPalette->AddItem("New Invoice", "/invoices/new", "invoice:new", "Create", "Ctrl+N");

  TsgcHTMLCommandItem *oItem = oPalette->Items->Add();
  oItem->Caption = "Export Report";
  oItem->Icon = "bi bi-download";
  oItem->DataAction = "report:export";
  oItem->Category = "Actions";

  String html = oPalette->HTML;   // hidden overlay + inline script
}
__finally
{
  delete oPalette;
}
using esegece.sgcWebSockets;

var palette = new TsgcHTMLComponent_CommandPalette();
palette.PaletteID = "app_commands";

palette.AddItem("New Invoice", "/invoices/new", "invoice:new", "Create", "Ctrl+N");

var item = palette.Items.Add();
item.Caption = "Export Report";
item.Icon = "bi bi-download";
item.DataAction = "report:export";
item.Category = "Actions";

string html = palette.HTML;   // hidden overlay + inline script

Key properties & methods

The members you reach for most often.

Items

Collection of TsgcHTMLCommandItem entries: Caption, Description, Icon, Href, DataAction, Shortcut (display only), Category and Enabled.

AddItem

Convenience method appending one entry and returning it, so you can still set Icon/Description afterward.

HotKey / HotKeyCtrl / HotKeyMeta

Single character plus modifiers; both Ctrl and Meta default True, so Ctrl+K and Cmd+K both open it out of the box.

MaxResults

Default 10; 0 shows every matching entry at once.

ShowCategories

Default True, groups the list under headings in first-appearance order (not alphabetical).

WSSend / Action

Activating a command dispatches a sgc:command DOM event always, and pushes over the sgcHTMX WebSocket bridge or POSTs to Action when either is set.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Get Started?

Download the free trial and start building web UIs in Delphi, C++ Builder and .NET.