def wrap_with_layout( content:FT, # The main content to display navbar:Optional=None, # Optional navbar component footer:Optional=None, # Optional footer component container_id:str='main-content', # ID for the main content container container_tag:str='div', # HTML tag for the container)->FT: # Main element with navbar and content
Wrap content with the full page layout including optional navbar and footer.
This utility provides a consistent page structure across your application. It wraps your content with optional navbar and footer components.
# Example: Simple layout with just contentfrom fasthtml.common import Div, H1, Pcontent = Div( H1("Page Title"), P("This is the main content"))page = wrap_with_layout(content)print("Layout with just content:")print(page)
Layout with just content:
<main><div id="main-content"><div><h1>Page Title</h1><p>This is the main content</p></div></div></main>