Adding Pages and Components to the App Model

In Bloqs, you can add pages to your app model easily and include components on each page. This allows you to structure your application and add UI elements programmatically.

Example

builder.AddPage(
    new Page
    {
        Id = AppConstants.Pages.HomePage,   // Unique page identifier
        Title = "Home",                     // Display title
        Name = "home",                      // Internal page name
        Area = ContainerComponent.Create(
            new HtmlComponent
            {
                HtmlContent =
                    "The journey of a thousand lines of code begins with a single idea, and a belief that innovation can turn complexity into simplicity. 🖼️",
            }
        ),
    }
);

Explanation

  • Id – A unique identifier for the page, often stored in AppConstants.

  • Title – The page’s display title shown in the UI.

  • Name – Internal name used for reference in code.

  • Area – A container for components on the page.

  • HtmlComponent – An example of a component you can place inside the page area. You can replace this with other components as needed.

Last updated