Popover Component — sgcHTML | eSeGeCe

Popover

TsgcHTMLComponent_Popover — attach a Bootstrap 5 popover with a title and body to any trigger element, with configurable placement, trigger and dismiss behavior, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_Popover

A popover component that wraps a trigger element with Bootstrap 5 popover data attributes and an auto-init script. Set the content, title and body, then read the HTML property — or call the static Build helper for a one-liner.

Component class

TsgcHTMLComponent_Popover

Renders

Bootstrap 5 popover markup

Languages

Delphi, C++ Builder, .NET

Build it in one line, or configure it fully

Call BuildButton(text, title, body, style, placement) for a popover button, or create the component, set Placement and Trigger, then read HTML.

uses
  sgcHTML_Enums, sgcHTML_Component_Popover;

// One-line static helper (primary form):
var
  vHTML: string;
begin
  vHTML := TsgcHTMLComponent_Popover.BuildButton('More info',
    'Pricing', 'All licenses include full source code.',
    bsPrimary, plTop);
  WebModule.Response := vHTML;
end;

// Or configure it fully:
var
  oPop: TsgcHTMLComponent_Popover;
begin
  oPop := TsgcHTMLComponent_Popover.Create(nil);
  try
    oPop.Content := '<a href="#" class="btn btn-info">Details</a>';
    oPop.Title := 'Shipping';
    oPop.Body := 'Free delivery on orders over 50.';
    oPop.Placement := plRight;
    oPop.Trigger := ptHover;
    oPop.Dismissible := True;

    WebModule.Response := oPop.HTML;   // trigger + popover init script
  finally
    oPop.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Popover.hpp

// One-line static helper (primary form):
String html = TsgcHTMLComponent_Popover::BuildButton("More info",
  "Pricing", "All licenses include full source code.",
  bsPrimary, plTop);

// Or configure it fully:
TsgcHTMLComponent_Popover *oPop = new TsgcHTMLComponent_Popover(NULL);
try
{
  oPop->Content = "<a href=\"#\" class=\"btn btn-info\">Details</a>";
  oPop->Title = "Shipping";
  oPop->Body = "Free delivery on orders over 50.";
  oPop->Placement = plRight;
  oPop->Trigger = ptHover;
  oPop->Dismissible = true;

  String html = oPop->HTML;   // trigger + popover init script
}
__finally
{
  delete oPop;
}
using esegece.sgcWebSockets;

// One-line static helper (primary form):
string html = TsgcHTMLComponent_Popover.BuildButton("More info",
    "Pricing", "All licenses include full source code.",
    TsgcHTMLButtonStyle.bsPrimary, TsgcHTMLPlacement.plTop);

// Or configure it fully:
var pop = new TsgcHTMLComponent_Popover();
pop.Content = "<a href=\"#\" class=\"btn btn-info\">Details</a>";
pop.Title = "Shipping";
pop.Body = "Free delivery on orders over 50.";
pop.Placement = TsgcHTMLPlacement.plRight;
pop.Trigger = TsgcHTMLPopoverTrigger.ptHover;
pop.Dismissible = true;

string html = pop.HTML;   // trigger + popover init script

Key properties & methods

The members you reach for most often.

Content

Content is the trigger element's inner HTML; when empty, a styled button built from Title and ContentStyle is used instead.

Popover text

Title sets the popover heading and Body its text (the Bootstrap data-bs-content).

Placement

Placement positions the popover with plTop, plBottom, plLeft or plRight via TsgcHTMLPlacement.

Trigger

Trigger selects ptClick, ptHover, ptFocus or ptManual; Dismissible closes it on the next outside click.

Initialization

AutoInit appends a script that calls new bootstrap.Popover for every popover; override the script via InitScript.

Static helpers & output

Build(content, title, body, placement, trigger) and BuildButton(text, title, body, style, placement) return ready markup; HTML emits the trigger plus its init script.

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.