EmptyState Component — sgcHTML | eSeGeCe

EmptyState

TsgcHTMLComponent_EmptyState — the panel a grid, a list or a search result shows when it has no rows: an icon or a picture, a title, a description and up to two buttons, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_EmptyState

Set Icon, Title and Description, then read the HTML property; it emits no script at all, so it is safe to push as an out-of-band fragment as often as a page needs.

Component class

TsgcHTMLComponent_EmptyState

Renders

A single placeholder <div>, no script

Languages

Delphi, C++ Builder, .NET

Say there is nothing here, properly

Icon accepts a CSS icon class or inline SVG markup, emitted verbatim after a narrow safety check; never bind end-user input to it — bind untrusted text to Title and Description instead, both always HTML-encoded.

uses
  sgcHTML_Enums, sgcHTML_Component_EmptyState;

var
  oEmpty: TsgcHTMLComponent_EmptyState;
begin
  oEmpty := TsgcHTMLComponent_EmptyState.Create(nil);
  try
    oEmpty.Icon := 'bi bi-inbox';
    oEmpty.Title := 'No results';
    oEmpty.Description := 'Try a different search, or clear your filters.';
    oEmpty.ActionCaption := 'Clear filters';
    oEmpty.ActionHref := '/orders';
    oEmpty.ActionStyle := bsPrimary;

    WebModule.Response := oEmpty.HTML;
  finally
    oEmpty.Free;
  end;
end;

// Or the one-line static helper for the simple case:
WebModule.Response := TsgcHTMLComponent_EmptyState.Build('No results', 'Try a different search.');
// includes: sgcHTML_Component_EmptyState.hpp

TsgcHTMLComponent_EmptyState *oEmpty = new TsgcHTMLComponent_EmptyState(NULL);
try
{
  oEmpty->Icon = "bi bi-inbox";
  oEmpty->Title = "No results";
  oEmpty->Description = "Try a different search, or clear your filters.";
  oEmpty->ActionCaption = "Clear filters";
  oEmpty->ActionHref = "/orders";
  oEmpty->ActionStyle = bsPrimary;

  String html = oEmpty->HTML;
}
__finally
{
  delete oEmpty;
}

// Or the one-line static helper for the simple case:
String html2 = TsgcHTMLComponent_EmptyState::Build("No results", "Try a different search.");
using esegece.sgcWebSockets;

var empty = new TsgcHTMLComponent_EmptyState();
empty.Icon = "bi bi-inbox";
empty.Title = "No results";
empty.Description = "Try a different search, or clear your filters.";
empty.ActionCaption = "Clear filters";
empty.ActionHref = "/orders";
empty.ActionStyle = ButtonStyle.bsPrimary;

string html = empty.HTML;

// Or the one-line static helper for the simple case:
string html2 = TsgcHTMLComponent_EmptyState.Build("No results", "Try a different search.");

Key properties & methods

The members you reach for most often.

Icon / ImageURL

CSS icon class or inline SVG (sanitized, drop-on-reject); ImageURL wins over Icon when both are set.

Title / Description

Always HTML-encoded, the safe pair to bind to database or user-supplied text.

ActionCaption / ActionHref / ActionStyle

The primary call-to-action button, styled through the shared TsgcHTMLButtonStyle enum, default bsPrimary.

SecondaryActionCaption / SecondaryActionHref

A second button, always outline-styled, no style property of its own.

Compact

Tighter padding for a small embedded area (a widget, a table body) instead of a whole page/section.

Build

Class function: constructs, sets Title/Description, renders and frees a temporary instance in one call.

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.