StatCard

TsgcHTMLComponent_StatCard — render a dashboard KPI/stat card with an icon, trend arrow and an optional gradient background, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_StatCard

A metric tile built on the Bootstrap card. Set a title and value, add an icon and a trend, optionally apply a gradient, then read the HTML property.

Component class

TsgcHTMLComponent_StatCard

Renders

Bootstrap 5 card markup

Languages

Delphi, C++ Builder, .NET

Create it, set the metric, render it

Assign Title and Value, pick a Color and a Trend, optionally a Gradient, then read HTML — or use the static one-line Build helper.

uses
  sgcHTML_Component_StatCard;

var
  oStat: TsgcHTMLComponent_StatCard;
begin
  oStat := TsgcHTMLComponent_StatCard.Create(nil);
  try
    oStat.Title := 'Monthly Revenue';
    oStat.Value := '$48,200';
    oStat.Icon := '●';
    oStat.Color := scSuccess;
    oStat.Trend := stUp;
    oStat.TrendValue := '12.5%';

    WebModule.Response := oStat.HTML;   // Bootstrap card
  finally
    oStat.Free;
  end;
end;

// Or in a single line with the static helper:
Result := TsgcHTMLComponent_StatCard.Build('Monthly Revenue', '$48,200',
  scSuccess, stUp, '12.5%', 'kpiRevenue', sgBlueViolet);
// includes: sgcHTML_Component_StatCard.hpp

TsgcHTMLComponent_StatCard *oStat = new TsgcHTMLComponent_StatCard(NULL);
try
{
  oStat->Title = "Monthly Revenue";
  oStat->Value = "$48,200";
  oStat->Icon = "●";
  oStat->Color = scSuccess;
  oStat->Trend = stUp;
  oStat->TrendValue = "12.5%";

  String html = oStat->HTML;   // Bootstrap card
}
__finally
{
  delete oStat;
}

// Or in a single line with the static helper:
String html = TsgcHTMLComponent_StatCard::Build("Monthly Revenue", "$48,200",
  scSuccess, stUp, "12.5%", "kpiRevenue", sgBlueViolet);
using esegece.sgcWebSockets;

var stat = new TsgcHTMLComponent_StatCard();
stat.Title = "Monthly Revenue";
stat.Value = "$48,200";
stat.Icon = "●";
stat.Color = TsgcHTMLStatColor.scSuccess;
stat.Trend = TsgcHTMLStatTrend.stUp;
stat.TrendValue = "12.5%";

string html = stat.HTML;   // Bootstrap card

// Or in a single line with the static helper:
string oneLine = TsgcHTMLComponent_StatCard.Build("Monthly Revenue", "$48,200",
    TsgcHTMLStatColor.scSuccess, TsgcHTMLStatTrend.stUp, "12.5%", "kpiRevenue",
    TsgcHTMLStatGradient.sgBlueViolet);

Key properties & methods

The members you reach for most often.

Metric

Title labels the card, Value shows the headline figure and Icon renders an inline icon glyph in the corner.

Trend

Trend (TsgcHTMLStatTrend: stUp, stDown, stNeutral) draws a colored arrow and TrendValue sets the delta text.

Color

Color (TsgcHTMLStatColor) themes the border, value and icon with a Bootstrap contextual color.

Gradient

Gradient (TsgcHTMLStatGradient) applies a preset gradient; GradientStartColor, GradientEndColor and GradientAngle define a custom one.

Extras

FooterText adds a caption row, CardID sets the DOM id and CSSClass appends extra classes.

One-line build

Build(aTitle, aValue, aColor, aTrend, aTrendValue, aCardID, aGradient) returns the card HTML in a single static call.

Keep exploring

All sgcHTML ComponentsBrowse the full feature matrix of 60+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

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