Toolbar

TsgcHTMLComponent_Toolbar — render a button toolbar that groups buttons with separators, icons and tooltips, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_Toolbar

A navigation component that emits a Bootstrap <div class="btn-toolbar"> of btn-groups split by separators. Add buttons (and separators), then read the HTML property.

Component class

TsgcHTMLComponent_Toolbar

Renders

Bootstrap btn-toolbar markup

Languages

Delphi, C++ Builder, .NET

Create it, add buttons, render it

Call AddButton for each button and AddSeparator to break the groups, then read HTML.

uses
  sgcHTML_Enums, sgcHTML_Component_Toolbar;

var
  oToolbar: TsgcHTMLComponent_Toolbar;
begin
  oToolbar := TsgcHTMLComponent_Toolbar.Create(nil);
  try
    oToolbar.Size := tbsDefault;

    oToolbar.AddButton('New', bsPrimary, '/new');
    oToolbar.AddButton('Edit', bsOutlinePrimary, '/edit');
    oToolbar.AddSeparator;
    oToolbar.AddButton('Delete', bsOutlineDanger, '/delete');

    WebModule.Response := oToolbar.HTML;   // <div class="btn-toolbar">
  finally
    oToolbar.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Toolbar.hpp

TsgcHTMLComponent_Toolbar *oToolbar = new TsgcHTMLComponent_Toolbar(NULL);
try
{
  oToolbar->Size = tbsDefault;

  oToolbar->AddButton("New", bsPrimary, "/new");
  oToolbar->AddButton("Edit", bsOutlinePrimary, "/edit");
  oToolbar->AddSeparator();
  oToolbar->AddButton("Delete", bsOutlineDanger, "/delete");

  String html = oToolbar->HTML;   // <div class="btn-toolbar">
}
__finally
{
  delete oToolbar;
}
using esegece.sgcWebSockets;

var toolbar = new TsgcHTMLComponent_Toolbar();
toolbar.Size = TsgcHTMLToolbarSize.tbsDefault;

toolbar.AddButton("New", TsgcHTMLButtonStyle.bsPrimary, "/new");
toolbar.AddButton("Edit", TsgcHTMLButtonStyle.bsOutlinePrimary, "/edit");
toolbar.AddSeparator();
toolbar.AddButton("Delete", TsgcHTMLButtonStyle.bsOutlineDanger, "/delete");

string html = toolbar.HTML;   // <div class="btn-toolbar">

Key properties & methods

The members you reach for most often.

Buttons

AddButton(text, style, href) appends a button; with no href it renders a <button>, otherwise an anchor styled as a button.

Groups

AddSeparator closes the current btn-group and starts a new one with a small gap, so buttons cluster into logical groups.

Items

Items.Add returns a TsgcHTMLToolbarItem for finer control: set Text, Href, ButtonStyle, Icon, Disabled, Separator and Tooltip.

Style

Per item, ButtonStyle picks any TsgcHTMLButtonStyle (solid or outline variant, default bsOutlinePrimary); Tooltip wires a Bootstrap tooltip.

Size

Size selects tbsDefault, tbsSmall or tbsLarge, applied to each button group; ToolbarID sets the id.

Output

HTML returns the full <div class="btn-toolbar"> with its button groups — serve it, or assign it to a page template's BodyContent.

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.