Documentation
¶
Overview ¶
templ: version: v0.3.1070
Package ui provides composable templ components, Tailwind styles and optional chart rendering. Applications retain their routes, permissions and live transport.
templ: version: v0.3.1070
Index ¶
- func Actions() templ.Component
- func Assets() fs.FS
- func Badge() templ.Component
- func Button(props ButtonProps) templ.Component
- func Dialog(props DialogProps) templ.Component
- func DialogBody() templ.Component
- func DialogHeader(props DialogHeaderProps) templ.Component
- func Field(props FieldProps) templ.Component
- func Input(props InputProps) templ.Component
- func LinkButton(props LinkButtonProps) templ.Component
- func MetricText(value string) string
- func PageHeader(props PageHeaderProps) templ.Component
- func Select(props SelectProps) templ.Component
- func Tab(props TabProps) templ.Component
- func Tabs(label string) templ.Component
- func VersionLabel(info versioning.Info) templ.Component
- func Widget(props WidgetProps) templ.Component
- func WidgetChart(props WidgetChartProps) templ.Component
- func WidgetData(label string) templ.Component
- func WidgetEmpty() templ.Component
- func WidgetHeader(props WidgetHeaderProps) templ.Component
- func WidgetMetric(label, value, note string) templ.Component
- func WidgetMetricFrame(props WidgetMetricProps) templ.Component
- func WidgetMetricValue(value, exact string) templ.Component
- type ButtonKind
- type ButtonProps
- type DialogHeaderProps
- type DialogProps
- type FieldProps
- type InputProps
- type LinkButtonProps
- type Option
- type PageHeaderProps
- type SelectProps
- type TabProps
- type WidgetChartProps
- type WidgetElement
- type WidgetHeaderProps
- type WidgetMetricProps
- type WidgetProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assets ¶
Assets hides the repository layout: consumers continue to see ui.css, charts.js and vendor filenames without a web/assets prefix. Serve with http.FileServer and http.StripPrefix at the application's chosen URL; no router is required.
func Button ¶
func Button(props ButtonProps) templ.Component
func Dialog ¶
func Dialog(props DialogProps) templ.Component
Dialog supplies the native shell; apps explicitly open it and own close/focus behavior, form submission and authorization. No content is moved or fetched here.
func DialogBody ¶
func DialogHeader ¶
func DialogHeader(props DialogHeaderProps) templ.Component
func Field ¶
func Field(props FieldProps) templ.Component
func Input ¶
func Input(props InputProps) templ.Component
func LinkButton ¶
func LinkButton(props LinkButtonProps) templ.Component
func MetricText ¶
Format only numeric metric labels. Keep units, unavailable values, small precise costs and partial-coverage qualifiers in their original form.
func PageHeader ¶
func PageHeader(props PageHeaderProps) templ.Component
func Select ¶
func Select(props SelectProps) templ.Component
func VersionLabel ¶
func VersionLabel(info versioning.Info) templ.Component
func Widget ¶
func Widget(props WidgetProps) templ.Component
Keep the existing root element, classes and live attributes without adding a wrapper: table scrolling, semantic landmarks and DOM patch identity depend on them.
func WidgetChart ¶
func WidgetChart(props WidgetChartProps) templ.Component
The stable canvas and fallback remain siblings. ECharts sizes its Canvas renderer from the parent frame and keeps one instance across live snapshots.
func WidgetData ¶
func WidgetEmpty ¶
func WidgetHeader ¶
func WidgetHeader(props WidgetHeaderProps) templ.Component
The children slot holds the view's actions or badges. Counts retain exact tooltips while using the same compact formatter as other numeric widgets.
func WidgetMetric ¶
func WidgetMetricFrame ¶
func WidgetMetricFrame(props WidgetMetricProps) templ.Component
func WidgetMetricValue ¶
Types ¶
type ButtonKind ¶
type ButtonKind string
const ( Primary ButtonKind = "primary" Secondary ButtonKind = "secondary" Danger ButtonKind = "danger" )
type ButtonProps ¶
type ButtonProps struct {
Type, Class string
Kind ButtonKind
Disabled bool
Attributes templ.Attributes
}
type DialogHeaderProps ¶
type DialogHeaderProps struct{ TitleID, Title, Description string }
type DialogProps ¶
type DialogProps struct {
ID, TitleID, Class string
Attributes templ.Attributes
}
type FieldProps ¶
type FieldProps struct {
For, Label, Hint, Class string
Attributes templ.Attributes
}
type InputProps ¶
type InputProps struct {
ID, Name, Value, Type, Placeholder, Class string
Required, Disabled bool
Attributes templ.Attributes
}
type LinkButtonProps ¶
type LinkButtonProps struct {
Href, Class string
Kind ButtonKind
Attributes templ.Attributes
}
type PageHeaderProps ¶
type PageHeaderProps struct {
Title, Description, Class string
Attributes templ.Attributes
}
Presentation props accept server-defined attributes for HTMX and other callers. Permissions, CSRF fields and event handlers remain the application's responsibility.
type SelectProps ¶
type SelectProps struct {
ID, Name, Value, Class string
Options []Option
Required, Disabled bool
Attributes templ.Attributes
}
type TabProps ¶
type TabProps struct {
Label, Href, Class string
Active bool
Attributes templ.Attributes
}
type WidgetChartProps ¶
type WidgetChartProps struct {
ID, Spec, Label string
EmptyMessage, NoScriptNote string
// ErrorMessage also applies when malformed JSON cannot supply messages.error.
ErrorMessage string
Compact bool
}
Spec is the feature's serialized chart configuration. It stays in an escaped attribute so the shared live renderer can reuse the existing canvas by ID. Specs use the documented shared core, not arbitrary renderer-specific options.
type WidgetElement ¶
type WidgetElement uint8
WidgetElement preserves the semantic containers used by existing pages. A closed set prevents callers from constructing arbitrary HTML tag names.
const ( WidgetSection WidgetElement = iota WidgetDiv WidgetAside )
type WidgetHeaderProps ¶
type WidgetMetricProps ¶
type WidgetProps ¶
type WidgetProps struct {
Element WidgetElement
Class string
Attributes templ.Attributes
}
WidgetProps contains presentation and trusted, server-defined attributes. Feature views retain responsibility for permission checks, links and data.