Container

En/ Ru

Container

Container wraps page content in a width shell.

github.com/fastygo/templ/ui

Summary

Container wraps page content in a width shell.Container supports div, main, or section root tags.

Use Cases

    Center content with max width utilities on Class

    Wrap main element for app shell layouts

Semantics

    ResolveTag uses TagGroupContainer from utils

    Invalid Tag falls back to div

Example tag.default

Page width content
import "github.com/fastygo/templ/ui"

templ Example() {
	@ui.Container(ui.ContainerProps{Class: "mx-auto max-w-5xl px-6"}) {
		Page width content
	}
}

Example tag.main

Main shell content
import "github.com/fastygo/templ/ui"

templ Example() {
	@ui.Container(ui.ContainerProps{Tag: "main", Class: "mx-auto max-w-5xl px-6"}) {
		Main shell content
	}
}

API

Attrs · templ.Attributes — role: html-attrs

Class · string — role: style-extension

Tag · string — role: shell-tag; enum: div|main|section; default: div; source: utils.tags.TagGroupContainer