✈️ FlightPlan Developer Guide

← Back to Guide

Layout & Container Elements

Five classes for grouping and structuring page content. Div is the workhorse generic container. Header, Footer, and Nav are semantic equivalents — same behavior, different HTML tag. Panel handles flex-based layouts and has its own dedicated guide page.

Quick Decision: Which Container?

Div

The generic container. Renders as <div>. Use it for grouping children that share a CSS class, attaching inline styles, or any case where you need a block element without semantic meaning.

// Plain div with a class
content.Add(new Div("card")).Add(new P("Card content"));

// Fluent builders
content.Add(new Div()
    .WithClass("highlight-box")
    .WithId("warning-area")
    .WithStyle(s => s.Background("#fff3cd").Padding("10px"))
    .WithText("Inline text content"));

// Wrapper for child elements
var wrapper = content.Add(new Div("section"));
wrapper.Add(new H3("Section Title"));
wrapper.Add(new P("Section body"));
Renders as:
A Div with inline styling — yellow background, rounded corners.

A Div wrapping children

With a heading and a paragraph inside.

Div: Closing Comments

Div optionally renders an HTML comment after its closing tag, helpful when reading deeply-nested generated HTML in browser DevTools. WithComment sets it explicitly; otherwise the CSS class is used as the comment automatically.

content.Add(new Div("dashboard-grid"));
// renders:  </div> <!-- dashboard-grid -->

content.Add(new Div().WithComment("end of filter section"));
// renders:  </div> <!-- end of filter section -->

Header

Renders as <header>. Use it for the visible header band at the top of a page (logo, page title, app name). The Guide app's own header — "✈️ FlightPlan Developer Guide" at the top of every page — is a Header instance built in GuideBasePage.CreateDocument().

// In your CreateDocument():
var header = doc.Add(new Header("guide-header"));
header.Add(new H1("✈️ FlightPlan Developer Guide"));
Renders as:

My App

Footer

Renders as <footer>. Counterpart to Header — the band at the bottom for copyright, contact links, version info. Same fluent API.

var footer = doc.Add(new Footer("guide-footer"));
footer.Add(new P("FlightPlan Framework - Copyright © 2025-2026 by Ted Lowery"));
Renders as:

My App © 2026

Nav

Renders as <nav>. Wrap navigation menus in this rather than a Div — screen readers and accessibility tools recognize <nav> as a navigation landmark.

var nav = header.Add(new Nav("main-nav"));
nav.Add(new A("/",        "Home"));
nav.Add(new A("/Reports", "Reports"));
nav.Add(new A("/Admin",   "Admin"));
Renders as:

Div vs Panel: When to Use Which

Both produce a <div>, but they're for different jobs. The rule of thumb:

Short version: if you're just grouping, use Div. If you're laying out, use Panel.

← Back to Guide

Please wait...