Client-side configuration
Lagoon client application (Blazor WebAssembly) configuration is distributed across four locations depending on the nature of the setting. Knowing where to configure each feature saves time: this page serves as an entry point and routing table to detailed pages.
What goes where?
| Location | File | What it's for |
|---|---|---|
| Application markup | App.razor, MenuConfiguration.razor (Shared project) | Visual structure: layout, zones, tabbed mode, navigation menu. |
| Application behaviors | Main.cs → OnConfigureBehavior(ApplicationBehavior app) | Global UI settings resolved at startup (toasters, tabs, button sizes, EULA…). |
| Application culture | Main.cs → OnInitCulture(ApplicationCultureInfo culture) | Date and number formats. |
| Project file | Client.csproj | Client-side compilation options, notably the Service Worker (offline mode). |
Much of the layout (tab activation, header, sidebar, footer, menu) is configured in the markup App.razor, not in OnConfigureBehavior. The latter only drives global behaviors resolved by code.
Feature summary table
| Feature | Location | Key element | Page |
|---|---|---|---|
| General structure (header, sidebar, footer) | App.razor | <LgApp DefaultLayout ShowHeader ShowSidebar ShowFooter> | Layout |
| Navigation menu | MenuConfiguration.razor | LgMenuItem, LgMenuTitle, LgMenuSeparator | Menu |
| Tab mode activation | App.razor | <LgApp IsTabbed="true"> | Tabs |
| Tabs open at startup | App.razor | <LgApp> content | Tabs |
| Saving open tabs | OnConfigureBehavior | app.TabSavingMethod | Tabs |
| Active tab reload | OnConfigureBehavior | app.TabReloadDisabled | Tabs |
| Mobile / Desktop rendering | Component / layout | media-adapted rendering | Mobile / Desktop |
| Date and number formats | OnInitCulture | ApplicationCultureInfo | Date & Number Formats |
| Offline mode (Service Worker) | Client.csproj | <ServiceWorkerEnabled> | Offline mode |
| Automatic Service Worker installation | OnConfigureBehavior | app.ServiceWorkerAutoInstall | Offline mode |
| Toasters (position, duration, bar) | OnConfigureBehavior | app.Toastr.* | Toasters |
| JavaScript interoperability | Component / service | IJSRuntime or JSInteropBase | JSInterop |
| Themes and styles | Client/resources/styles/ | main.scss, theme-<name>.scss, App:Theme | Themes and styles |
| Loading spinner | main.scss | $spinner, $sp-color, $sp-color-alt | Spinner |
| RCL pages, lazy loading | Client.csproj, Main.cs | <BlazorWebAssemblyLazyLoad>, app.LazyAssemblies, OnNavigateAsync | RCL and lazy loading |
Additional settings via OnConfigureBehavior
The ApplicationBehavior object exposes other global properties useful on the client side, without a dedicated page:
| Property | Effect | Default value |
|---|---|---|
app.ToolbarButtonSize | Default size of toolbar buttons. | ButtonSize.Medium |
app.FrameToolbarButtonSize | Size of toolbar buttons in frames. | ButtonSize.Small |
app.ActionPanelToolbarButtonSize | Size of toolbar buttons in action panels. | ButtonSize.Small |
app.ColorPalette | List of colors offered by the color picker. | built-in palette |
app.EditForm | Default options for LgEditForm forms. | — |
app.Select | Default options for LgSelect / LgSelectMultiple. | — |
app.ResetButton | Configuration of the field reset button. | — |
app.RoundMode | Default rounding mode of LgNumericBox. | MidpointRounding.ToEven |
app.HttpClientDefaultTimeout | Default timeout of the HTTP client. | 100 seconds |
app.RgaaSupport | Enables RGAA support for the application. | false |
app.DevelopedByLogoUri / app.OwnerLogoUri | Logos displayed on the "About" page. | — |
app.RequireEulaConsent / app.EulaFromServer | Management of EULA consent. | false |
Some properties of ApplicationBehavior belong to cross-cutting topics: EULA consent is detailed in EULA, and app.DefaultAcceptHeader (JSON / MessagePack negotiation) in MessagePack.
Example Main.cs
Typical skeleton of the Main class from the Client project, annotated by feature.
public class Main : LgCustomApplication
{
// Global UI behaviors resolved at startup.
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Save open tabs to the server database.
app.TabSavingMethod = TabSavingMethod.Remote;
// Toasters: position and display duration.
app.Toastr.Position = Position.TopRight;
app.Toastr.TimeOut = 5000;
// Logos displayed on the "About" page.
app.DevelopedByLogoUri = new List<string> { LOGO_URI_DZ };
}
// Date and number formats for the application.
protected override void OnInitCulture(ApplicationCultureInfo culture)
{
base.OnInitCulture(culture);
// Format customization here (e.g., short date format).
}
// Service and root component registration.
protected override void OnInitialize(WebAssemblyHostBuilder builder)
{
builder.RootComponents.Add<Shared.App>("#app");
Services.Registry.RegisterServices(builder.Services);
}
}
See also
- Server-side configuration: Logs, SMTP Mail, Authentication & authorization.
- Cross-cutting configuration: Application, appsettings.json.