Login

TsgcHTMLComponent_Login — a ready-made login form with username, password, remember-me and error/success alerts, rendered as a card, centered or full-page layout, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_Login

A drop-in login component that emits a Bootstrap 5 form. Set the action, labels and style, optionally add a logo and footer link, then read the HTML property — or call GetFullPageHTML for a complete document.

Component class

TsgcHTMLComponent_Login

Renders

Bootstrap 5 login form markup

Languages

Delphi, C++ Builder, .NET

Create it, configure it, render it

Set FormAction, the labels and LoginStyle, then read HTML — or call GetFullPageHTML to emit a complete HTML document.

uses
  sgcHTML_Enums, sgcHTML_Component_Login;

var
  oLogin: TsgcHTMLComponent_Login;
begin
  oLogin := TsgcHTMLComponent_Login.Create(nil);
  try
    oLogin.FormAction := '/login';
    oLogin.FormMethod := 'POST';
    oLogin.Title := 'Sign in';
    oLogin.UserLabel := 'Email';
    oLogin.PasswordLabel := 'Password';
    oLogin.ShowRememberMe := True;
    oLogin.LoginStyle := lsFullPage;
    oLogin.ButtonStyleEnum := bsPrimary;
    oLogin.SetLogoText('Acme Inc.');
    oLogin.SetFooterText('Forgot your password?');

    WebModule.Response := oLogin.HTML;   // Bootstrap login form
  finally
    oLogin.Free;
  end;
end;

// Or emit a full standalone HTML document (with the Bootstrap links):
oLogin.BootstrapCSSPath := '/bootstrap.min.css';
Response := oLogin.GetFullPageHTML('Sign in — Acme');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Login.hpp

TsgcHTMLComponent_Login *oLogin = new TsgcHTMLComponent_Login(NULL);
try
{
  oLogin->FormAction = "/login";
  oLogin->FormMethod = "POST";
  oLogin->Title = "Sign in";
  oLogin->UserLabel = "Email";
  oLogin->PasswordLabel = "Password";
  oLogin->ShowRememberMe = true;
  oLogin->LoginStyle = lsFullPage;
  oLogin->ButtonStyleEnum = bsPrimary;
  oLogin->SetLogoText("Acme Inc.");
  oLogin->SetFooterText("Forgot your password?");

  String html = oLogin->HTML;   // Bootstrap login form

  // Or a full standalone document:
  String page = oLogin->GetFullPageHTML("Sign in");
}
__finally
{
  delete oLogin;
}
using esegece.sgcWebSockets;

var login = new TsgcHTMLComponent_Login();
login.FormAction = "/login";
login.FormMethod = "POST";
login.Title = "Sign in";
login.UserLabel = "Email";
login.PasswordLabel = "Password";
login.ShowRememberMe = true;
login.LoginStyle = TsgcHTMLLoginStyle.lsFullPage;
login.ButtonStyleEnum = TsgcHTMLButtonStyle.bsPrimary;
login.SetLogoText("Acme Inc.");
login.SetFooterText("Forgot your password?");

string html = login.HTML;   // Bootstrap login form

// Or a full standalone document:
string page = login.GetFullPageHTML("Sign in");

Key properties & methods

The members you reach for most often.

Form

FormAction and FormMethod set where the form posts; FormID names it. The form always posts username, password and (optionally) remember.

Labels & text

Title, Subtitle, UserLabel, PasswordLabel, UserPlaceholder, PasswordPlaceholder and ButtonText control the copy.

Style

LoginStyle picks lsCard, lsCentered or lsFullPage; ButtonStyleEnum, MaxWidth, MinHeight, BackgroundClass and CSSClass tune the look.

Options & alerts

ShowRememberMe adds the checkbox; ErrorMessage and SuccessMessage render danger/success alerts above the form.

SetLogoText(aText) and SetFooterText(aText) are quick helpers; LogoHTML, FooterHTML, FooterLinkText and FooterLinkURL give full control.

Output

HTML returns the form markup. GetFullPageHTML(const aPageTitle) emits a complete HTML document, linking BootstrapCSSPath and BootstrapJSPath.

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 add a login form to your Delphi, C++ Builder or .NET web app.