Documentation
¶
Overview ¶
templ: version: v0.3.1001
templ: version: v0.3.1001
Index ¶
- func CSRFField(c echo.Context) templ.Component
- func DangerSection(help string) templ.Component
- func Field(label, help string) templ.Component
- func FieldError(field string, err string) templ.Component
- func FieldErrorOOB(field string, err string) templ.Component
- func GetError(errors map[string]string, field string) string
- func Inherited(value, from string) templ.Component
- func OOBValidator(c echo.Context, field, errMsg string) error
- func Save(label string) templ.Component
- func Section(title string, scope Scope, help string) templ.Component
- func SettingsForm(c echo.Context, postURL string) templ.Component
- func SettingsFormUpload(c echo.Context, postURL string) templ.Component
- func SettingsLayout(items []NavItem) templ.Component
- func SettingsNav(items []NavItem) templ.Component
- type NavItem
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DangerSection ¶
DangerSection is the same card in the danger palette. Always rendered last on a page.
func Field ¶
Field wraps one labelled control. Every settings input gets a real label, placeholder-only inputs are not acceptable here.
func FieldError ¶
FieldError renders a validation error for a form field. Always renders the element so it can be targeted by OOB swaps.
func FieldErrorOOB ¶
FieldErrorOOB renders an out-of-band swap for a field error (used with HTMX blur validation).
func Inherited ¶
Inherited annotates a cascade field with the value it would take if left empty, and where that value comes from. Inherited names where a value came from, not just what it is: knowing that a limit is 2 cores is no use without knowing which level to go and change.
func OOBValidator ¶
OOBValidator renders per-field validation errors as OOB HTML swaps. Use with validate.WithOOBRenderer(form.OOBValidator).
func Save ¶
Save is the uniform submit control. Pass a label only where the action genuinely differs from saving (for example "Save & plan", which also runs a config plan).
func Section ¶
Section is the standard settings card: title, scope badge, optional explanation, then content.
func SettingsForm ¶
SettingsForm wraps a section's controls: it carries the CSRF token and wires the dirty-state tracking behind the save button. Taking the context is what makes the token automatic, a settings form that forgets it just 403s.
func SettingsFormUpload ¶
SettingsFormUpload is SettingsForm for a section containing a file input. htmx posts urlencoded by default, which silently drops the file, hx-encoding is what makes the upload actually arrive.
func SettingsLayout ¶
SettingsLayout pairs the sub-nav with the section body.
func SettingsNav ¶
SettingsNav renders the left rail of a settings page. Collapses to a horizontal scroller on narrow screens.
Types ¶
type NavItem ¶
type NavItem struct {
Active bool
}
NavItem is one entry in a settings sub-nav. Href is a real URL so every section is deep-linkable and survives a reload.