CheckBox Component — sgcHTML | eSeGeCe

CheckBox

TsgcHTMLComponent_CheckBox — a checkbox (or toggle switch) input with a label and dataset binding that renders Bootstrap 5 form-check markup, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_CheckBox

A standalone boolean input that emits a Bootstrap form-check — flip Switch to render it as a toggle. Set the name, label and checked state, then read the HTML property. It ships in the same unit as the sibling Edit, Memo and RadioGroup inputs.

Component class

TsgcHTMLComponent_CheckBox

Renders

Bootstrap 5 form-check input

Languages

Delphi, C++ Builder, .NET

Create it, configure it, render it

Set Name, Label_ and Checked (and optionally Switch), then read HTML (or drop it into a TsgcHTMLTemplate_Bootstrap page).

uses
  sgcHTML_Component_Edit;

var
  oCheck: TsgcHTMLComponent_CheckBox;
begin
  oCheck := TsgcHTMLComponent_CheckBox.Create(nil);
  try
    oCheck.Name := 'newsletter';
    oCheck.Label_ := 'Subscribe to the newsletter';
    oCheck.Checked := True;
    oCheck.Switch := True;   // render as a toggle switch

    WebModule.Response := oCheck.HTML;   // Bootstrap form-check
  finally
    oCheck.Free;
  end;
end;

// Or bind it to a boolean dataset field:
oCheck.DataField := 'Active';
oCheck.DataSource := dsCustomer;
// includes: sgcHTML_Component_Edit.hpp

TsgcHTMLComponent_CheckBox *oCheck = new TsgcHTMLComponent_CheckBox(NULL);
try
{
  oCheck->Name = "newsletter";
  oCheck->Label_ = "Subscribe to the newsletter";
  oCheck->Checked = true;
  oCheck->Switch = true;   // render as a toggle switch

  String html = oCheck->HTML;   // Bootstrap form-check
}
__finally
{
  delete oCheck;
}
using esegece.sgcWebSockets;

var check = new TsgcHTMLComponent_CheckBox();
check.Name = "newsletter";
check.Label_ = "Subscribe to the newsletter";
check.Checked = true;
check.Switch = true;   // render as a toggle switch

string html = check.HTML;   // Bootstrap form-check

Key properties & methods

The members you reach for most often.

Identity

Name sets the field name, Label_ the visible caption and CheckBoxID the element id (defaults to chk_<Name>).

State

Checked sets the initial value and Disabled greys the control out.

Switch

Switch swaps the box for a Bootstrap form-switch toggle while keeping the same checkbox semantics.

Dataset binding

DataField plus an assigned DataSource sets Checked from the current record's boolean field.

Output & siblings

HTML returns the form-check wrapper with its input and label. The same unit declares the sibling TsgcHTMLComponent_Edit, TsgcHTMLComponent_Memo and TsgcHTMLComponent_RadioGroup inputs.

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.