layouts

package
v0.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

templ: version: v0.3.977

templ: version: v0.3.977

Index

Constants

View Source
const DrawerID = "dashboard"

DrawerID is the fixed ID for the dashboard's sidebar drawer.

Variables

This section is empty.

Functions

func Base

func Base(props BaseProps) templ.Component

func Dashboard

func Dashboard(props DashboardProps) templ.Component

Types

type AppBranding

type AppBranding struct {
	// Name is the application name shown in headers/sidebars
	Name string
	// LogoFullUrl is the URL to the full logo image
	// e.g. https://example.com/logo-full.png
	LogoFullUrl string
	// Href is the logo click destination (defaults to "/")
	Href string
}

AppBranding configures application branding used across layouts. This is shared between Dashboard, Auth pages, and other layouts.

func (AppBranding) DefaultHref

func (b AppBranding) DefaultHref() string

DefaultHref returns the href to use, defaulting to "/" if not set.

func (AppBranding) DefaultLogoUrl

func (b AppBranding) DefaultLogoUrl() string

DefaultLogoUrl returns the logo URL to use, defaulting to "/assets/logo.png" if not set.

func (AppBranding) DefaultName

func (b AppBranding) DefaultName() string

DefaultName returns the name to use, defaulting to "App" if not set.

type BaseProps

type BaseProps struct {
	Title       string
	Description string
	CSRFToken   string          // passed by app layout from context
	Theme       string          // passed by app layout from context
	Head        templ.Component // optional: stylesheets, scripts, etc.
	BodyEnd     templ.Component // optional: extra content before panels
}

type DashboardProps

type DashboardProps struct {
	BaseProps

	// App configures branding in sidebar header
	App AppBranding

	// User configures the user section in sidebar footer
	User UserInfo

	// UserMenu items shown in the user dropdown
	UserMenu []UserMenuItem

	// Nav is the sidebar navigation structure
	Nav []NavGroup

	// CurrentPath highlights the active nav item
	CurrentPath string

	// ShowDetailPanel enables the right-side detail panel (controlled by Datastar signals)
	ShowDetailPanel bool

	// HeaderActions is an optional slot for action buttons in the navbar
	HeaderActions templ.Component

	// ThemeToggle enables a light/dark theme toggle in the navbar.
	// When set, a sun/moon toggle appears in the navbar end section.
	ThemeToggle *ThemeToggleConfig
}

DashboardProps configures the dashboard layout.

type NavGroup struct {
	Title string
	Items []NavItem
}

NavGroup is a titled group of navigation items.

type NavItem struct {
	Label  string
	Href   string
	Icon   icon.IconType
	Active bool
}

NavItem is a single navigation item in the sidebar.

type PanelSignals

type PanelSignals struct {
	Open bool `json:"open"`
}

PanelSignals holds the reactive state for the right-side detail panel.

type ThemeToggleConfig added in v0.0.7

type ThemeToggleConfig struct {
	DarkTheme  string // theme name when toggled on (e.g. "dark")
	LightTheme string // theme name when toggled off (e.g. "silk")
}

ThemeToggleConfig configures the theme toggle in the navbar header.

type UserInfo

type UserInfo struct {
	Name   string
	Email  string
	Avatar string
}

UserInfo configures the user section in the sidebar footer.

type UserMenuItem

type UserMenuItem struct {
	Label string
	Href  string
	Icon  icon.IconType
}

UserMenuItem is a single item in the user dropdown menu.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL