RadioGroup Component — sgcHTML | eSeGeCe

RadioGroup

TsgcHTMLComponent_RadioGroup — a group of mutually exclusive radio options with a label and stacked or inline layout that renders Bootstrap 5 form-check radios, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_RadioGroup

A standalone single-choice input that emits a set of Bootstrap form-check radios sharing one Name. Add the option captions to Items, pick a SelectedIndex, then read the HTML property. It ships in the same unit as the sibling Edit, Memo and CheckBox inputs.

Component class

TsgcHTMLComponent_RadioGroup

Renders

Bootstrap 5 form-check radios

Languages

Delphi, C++ Builder, .NET

Create it, add options, render it

Set Name and Label_, add captions to the Items string list, choose a SelectedIndex, then read HTML (or drop it into a TsgcHTMLTemplate_Bootstrap page).

uses
  sgcHTML_Component_Edit;

var
  oRadio: TsgcHTMLComponent_RadioGroup;
begin
  oRadio := TsgcHTMLComponent_RadioGroup.Create(nil);
  try
    oRadio.Name := 'plan';
    oRadio.Label_ := 'Choose a plan';
    oRadio.Items.Add('Free');
    oRadio.Items.Add('Pro');
    oRadio.Items.Add('Enterprise');
    oRadio.SelectedIndex := 1;
    oRadio.InlineLayout := True;

    WebModule.Response := oRadio.HTML;   // Bootstrap form-check radios
  finally
    oRadio.Free;
  end;
end;
// includes: sgcHTML_Component_Edit.hpp

TsgcHTMLComponent_RadioGroup *oRadio = new TsgcHTMLComponent_RadioGroup(NULL);
try
{
  oRadio->Name = "plan";
  oRadio->Label_ = "Choose a plan";
  oRadio->Items->Add("Free");
  oRadio->Items->Add("Pro");
  oRadio->Items->Add("Enterprise");
  oRadio->SelectedIndex = 1;
  oRadio->InlineLayout = true;

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

var radio = new TsgcHTMLComponent_RadioGroup();
radio.Name = "plan";
radio.Label_ = "Choose a plan";
radio.Items.Add("Free");
radio.Items.Add("Pro");
radio.Items.Add("Enterprise");
radio.SelectedIndex = 1;
radio.InlineLayout = true;

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

Key properties & methods

The members you reach for most often.

Identity

Name is shared by every radio so they form one group, Label_ is the group caption and RadioGroupID seeds the per-option element ids (defaults to rg_<Name>).

Options

Items is a TStringList — add one caption per choice with Items.Add; each entry becomes a radio whose value is the caption text.

Selection

SelectedIndex marks the pre-checked option (default -1, none selected).

Layout

InlineLayout lays the radios out horizontally with form-check-inline; leave it off for a stacked list.

State

Disabled greys out the whole group.

Output & siblings

HTML returns the labelled radio group. The same unit declares the sibling TsgcHTMLComponent_Edit, TsgcHTMLComponent_Memo and TsgcHTMLComponent_CheckBox 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.